All Sheets Update Status Change Date Automatically
Learn how to automatically update the last modified date across all sheets in your Google Sheets document using Apps Script. This video provides a step-by-step guide to implementing this feature effectively.
In a previous video, I showed you how to add this automatic last updated timestamp to sheet one, and someone nicely asked, "Can I do that to all my sheets?" Well, I'm gonna show you in this video. Go up to Extensions, Apps Script We have this function onEdit. We're looking at an event, and we're getting the row and the column from that and basically saying, if the row is greater than one and the column is actually number two, then go and get a date in this particular format . And then here's our place where we set that value in column three or C on the row on the sheet called Sheet1. Well, this onEdit is going to be happening on every single sheet. So how can we create a new sheet, call it Sheet2, and it'll also work on there? Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet? How To Create a Stop Watch in Google Sheets Timestamp When Done on Certain Sheet
Now, one caveat and one big thing I need to sh- share with you before I show you what to do. If you want it to work on all sheets, it's going to work on all sheets, so all of your sheets need to be exactly the same thing in this column. Now, there are other things that could be different, but the C column in this particular case, when we have this column three, needs to be the same on every sheet. Okay, so it's really simple. In this last line, SpreadsheetApp . activeSpreadsheet.getSheetByName, we're not gonna get the sheet by name. We're gonna delete that, and we're gonna go getActiveSheet. And then make sure you add the parentheses. So if you use autocomplete here to getActiveSheet correctly, active capital A, Sheet capital S, usually you have to add these open and close parentheses. And now if I save this, let's see if it'll work. It started-- Oh yeah, we didn't start that one. Spreadsheet Automation 101 Lesson 1: getActiveSpreadsheet() vs getActiveSheet() Getting Started Coding in Apps Script Activate A Certain Sheet When Opening a Spreadsheet
And there you go. You see these are changing now even though we're on Sheet2. Isn't that cool? So now this will work on every single sheet that we create in our spreadsheet file. 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 Better Sheets Videos Checklist Make It Easier For Others To Use Your Google Sheets Advanced Coding in Google Sheets for Programmers Button Styles