How to auto update date in Google Sheets

Ok, here is a modified version of the code in my previous answer:

function onEdit(e) { // Your sheet params var sheetName = "MySheet"; var dateModifiedColumnIndex = 2; var dateModifiedColumnLetter = 'B'; var range = e.range; // range just edited var sheet = range.getSheet(); if (sheet.getName() !== sheetName) { return; } // If the column isn't our modified date column if (range.getColumn() != dateModifiedColumnIndex) { var row = range.getRow(); var time = new Date(); time = Utilities.formatDate(time, "GMT-08:00", "MM/dd/yy, hh:mm:ss"); var dateModifiedRange = sheet.getRange(dateModifiedColumnLetter + row.toString()); dateModifiedRange.setValue(time); }; };

What this does is grabs the row of any cell that is changed and assigns a timestamp to the second column of that particular row.

To implement, all you need to do is go into the spreadsheet and click on Tools > Script Editor. In the resulting editor page, just paste this in there. Since this is an onEdit() function, it should work without having to add anything else to the cells of your spreadsheet, just paste it into the editor and save it.

For the timestamp, I set the format to MM/dd/yy and left the time. If you want to change it, you can just change the use of Utilities.formatDate.