Skip to content

Instantly share code, notes, and snippets.

@Stephen-Cronin
Last active September 13, 2016 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stephen-Cronin/dfe31f17f01528c2bf1b363cba4eb4d6 to your computer and use it in GitHub Desktop.
Save Stephen-Cronin/dfe31f17f01528c2bf1b363cba4eb4d6 to your computer and use it in GitHub Desktop.
Last Updated Column in Google Spreadsheets
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveCell();
if( r.getColumn() != 2 && r.getRow() != 1 ) { //checks the column
var row = r.getRow();
var time = new Date();
var timezone = CalendarApp.getDefaultCalendar().getTimeZone();
time = Utilities.formatDate(time, timezone, "dd/MM/yyyy, hh:mm:ss");
SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);
};
};
@Stephen-Cronin
Copy link
Author

Uses code from http://webapps.stackexchange.com/questions/37408/auto-updating-column-in-google-spreadsheet-showing-last-modify-date

I added the timezone code found on that page, moved it to Australian date format and also modified it to ignore changes to the header row

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment