Autofill Today's Date When Cell Edited

Learn how to automatically fill in today's date in Google Sheets when a cell is edited, using Google Apps Script. This tutorial simplifies the process of tracking status changes without manual entry.

No more hand typing. When we say something's in progress, we change the status column here and we need to type in today's date or even use equals today or just have, uh, data validation . Is validate, do it for the entire column . And now we have a picker. Ah, we don't even need to do that. We can actually automatically select anything in this status column pending and when it's changed, update the C column. Let's do that with app script extensions. App script . We're gonna use a function called on edit, and if we use this correctly, capitalize ON, then capital E, edit and put an E here or event.

This is a built in simple trigger that has some really cool data . Variable row equals event. That range dot get row so we know what row we're on. We also know what column we're on, get column, and we can use an if to say if the row is greater than one, meaning not the head of row. Double ampersand for and and column is equal to two equal signs. Two meaning we are in this second column here, B column. Then go to the spreadsheet we're on. Get active spreadsheet , get sheet by by name, which is in our case sheet one. Get range and our range is going to be whatever row we're on column

three for C set value and we want to put in date, well what's the date? We can get the date variable date equals new date. But we can format this any way we want. We can do utilities dot format , date, take the new date and get the time zone of the sheet we're on. And format it. Let's say it's month, month slash DD slash year, year, year in parentheses, command S for save. Now, every time I change this, it it adds the date here. If we don't want that leading zero, we can come back to our editor and just put D here instead of DD or M here for just m.

And now let's make new task. Let's put pending. And there we go. Last updated. Here. We can see that it's last updated. If we update it here. Not started. And this is done. And both these dates are changing. There you go. That's how to update the status change date. Automatically autofill a date anytime you're editing some particular column. Hopefully this is really awesome for you. And if you are interested in getting this app script go ahead. Down below in the description, I have a link directly to the sheet. You can copy it directly to your Google Drive. You are watching better sheets here on YouTube. Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how tos, get more out of your Google

sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos. But for right now, right here, one of these videos is gonna be your next Google sheet.