Reputation: 3338
I am using Google Spreadsheets
and what I am trying to do is update the cells that contain a timestamp
in the Time last Updated
column each time I update a cell in the same row.
Is there any way I can achieve that?
Thanks in advance,
Upvotes: 0
Views: 91
Reputation: 27262
not tested but something like this should work. Since you didn't provide any details, you will have to change some variables according to your needs.
function onEdit(e) {
var startCol = 2,
endCol = 10,
tsCol = 11, //this is the column where the timestamp will appear
startRow = 2,
sheetName = 'Sheet1', //this is the name of the sheet you want the script to work on.
curSheet = e.source.getActiveSheet();
//exit script when edits are made another sheet, or in the first row, or before col 2 or after col 10
if (curSheet.getName() !== sheetName || e.range.columnStart < startCol || e.range.columStart > endCol || e.range.rowStart < startRow) return;
curSheet.getRange(e.range.rowStart, tsCol)
.setValue(new Date());
}
Upvotes: 1