Skip to content

Instantly share code, notes, and snippets.

@ajot
Created June 20, 2014 20:12
Show Gist options
  • Select an option

  • Save ajot/88ca5377cbde7963c552 to your computer and use it in GitHub Desktop.

Select an option

Save ajot/88ca5377cbde7963c552 to your computer and use it in GitHub Desktop.
Get Last Updated Date - Google Spreadsheet
function onEdit() {
Logger.log("Starting");
var email = Session.getEffectiveUser().getEmail();
Logger.log(email);
// Getting the Current Spreadsheet
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveCell(); //Getting the active cell
if( r.getColumn() != 2 ) { //checks the column
if( r.getRow() != 1 ) { //Excluding the header
var row = r.getRow();
// var time = new Date();
// time = Utilities.formatDate(time, "GMT-08:00", "MM/DD/yy");
var formattedDate = Utilities.formatDate(new Date(),"GMT-04:00","MM-dd-yyyy 'at' HH:mm:ss z");
Logger.log("formattedDate");
SpreadsheetApp.getActiveSheet().getRange('K' + row.toString()).setValue(formattedDate); //Inserting the date in the cell
// Getting the current user. Needs Auth
var email = Session.getActiveUser().getEmail();
Logger.log(email);
SpreadsheetApp.getActiveSheet().getRange('E' + row.toString()).setValue(email);
};
};
};
@Zasinas2000
Copy link
Copy Markdown

Hello

thank You for Your answer. but how to get email receiving date by specific email addresses list to. so all dates could fill the row?

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