Wednesday, September 11, 2013

Google Spreadsheet Script to update time when changes are made on sheet


( by Henry Mitchell )

I was wondering how to update the time for each  individual sheet when changed. Currently I have a GoogleDoc with 4 sheets. I have put the formula "=Now()" on all sheets, but when one is changed, they all update the time. I want to know how to get the time to update for just the sheet modified.


Have a look at the following code:


// This script has been developed by Kishan
// For more visit:

function onEdit(e) {

function timeupdate() {
  var date = Utilities.formatDate(new Date(), "GMT-0500", "MM/dd/yyyy hh:mm:ss");
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = ss.getActiveSheet();
  var r = s.getRange("A1").setValue(date);



put the above code in your script editor and then whenever you edit on any sheet, it will automatically update the current time on Cell "A1" of that sheet.

You can change the cell "A1" as per your requirement. And also adjust the timezone "GMT-0500" as per your requirement.

And If you are not much familiar with scripts then check out the following link: 

I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.

I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: 


No comments:

Post a Comment