Weight Tracker Reverse Chronological
Learn how to create a reverse chronological weight tracker in Google Sheets that allows you to easily input your weight without scrolling. This tutorial covers the use of Google Apps Script to automate daily entries.
If you notice this waist tracker, it is a little different than normal. It is in reverse chronological order. That is because I want to have the exact same place to enter my weight every day. I don't want to have to scroll to the bottom as I do this for 100 days, 200 days, 300 days. I don't want to scroll to the bottom and figure out where to put my weight. I want to just add it to the top. Yeah, I'm lazy and I'm trying to lose weight, right? Well, this is going to change your Google Sheets. So, how do we get every single day to add a row and have the date here already there? And we just enter the weight and that is it. Well, go over to extensions appscript and we're going to go here. I'm going to call this reverse chronological. I'm going to create a function called add. We're going to name this weight. So, we have a sheet. So, we
know spreadsheet app.getactive spreadsheet . I'm going to insert a row. I can do either after or before. For this case, I'm going to do before, too. Why that is is that if I put in insert row after, it's going to get the exact same format as that row. So, if I do the first row, it's going to have this wonky format . I really want the same format that I have in 2 3 4 5. So, I actually want to insert before two, not after one. And then I'm going to take this exact same part spreadsheet app get active spreadsheet get sheet by name get range and in the row to column two
actually one sorry I'm going to set value and it's going to be new date. Now, here's something I can do with new date. Instead of putting it here, I can write today and I can write variable today equals new date. And why I do this is because I want to format it. Utilities. format date. And here I I'm going to enter whatever time zone you're in. GMT minus 6 or plus 6 format is going to be DD slash that is going to be this here. Right? It should be right. going to add that parenthesis and save this. Now, here's the automation magic. This is called function add date and I can run it to test it. I'm going to review my permissions. Make sure I have
no errors. And yes, I have exact Oh, actually, I think I did this reversed. Oh, no. That is actually today's date. I just had I just had these dates wrong. So, yes, this is today's date. It's correct. And I have a weight here that all I have to do is add All right, I'm going the wrong way. Uh, but let's automate this. Let's go over to triggers on the left side. Go to add trigger on the bottom right. Choose which function to run, which will be add date. Not from spreadsheet , but time driven. Not hour timer, but daytime. Well, actually, we could probably do 4 a.m. to 5:00 a.m. Sure. Save that. I'll check my weight around 5 to 7 a.m. And we may have to authorize again. Yeah, we do. And there we go. We have this. and
it's going to enter it for us every day. If we want to change this, we can uh go click the pencil icon, change it, or click the three dots to delete that trigger forever. And we can always add it again if we want. And that's a reversed chronological weight tracker. You're watching Better Sheets here on YouTube. You have two options here for your next video. Before you go, comment down below if you have any question whatsoever, and I'll make future videos from those questions. But for right here, right now, one of these videos could be your next Google Sheet.