Timestamp Column in Google Sheets

Learn how to create a timestamp column in Google Sheets that automatically updates whenever you edit a cell in that column using Google Apps Script.

We are gonna timestamp the column based on any edit to the entire column . We're going to do this with a little bit of abs script extensions, abs script. First thing we'll do is use the on edit function . We'll put an E here that's a variable. That could be any word or text there, but it gives us some interesting information like what row we're on, which is E range dot get row, and also what column we're on call equals E range dot column with a capital C column. And if the row is greater than one. We are gonna execute something which is spreadsheet app, get active sheet , get range , and the range is going to be whatever, uh, the number one, and then call whichever column we're on. And we're going to set value.

And the easiest thing to do is just new date here. We can format this if we want. So I'm gonna say new date and create a variable. New date equals utilities do format , date, new date. I'm gonna select time zone , GMT. And the string I want is just. DAYDAY slash MM slash year. So I want capital M'S for a month. Let's save this and see how it does. So all I'm doing is saving and going back to the sheet, and I'm gonna write in 44 here. And we can see already the last update is working. Let's make that a little bit smaller. Let's go 67 and let's give a little quick 12, 10, 5.

And you can see these timestamps are actually showing up, so if we want a timestamp as well. We can go back to our editor and instead of this being just the day, we can say hour, minute as well, and save that and let's go change 'em. 45. We can see that time changed. 44. And there's the date and the time. A little nice timestamp for all of these changes for anything in the column. So if I changed here, 44 99, let's see here. That's a lot of sales, but our timestamp is working. There you go. If you want this code, go down below. I'll put it in the description. 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.