I've been working on a Google spreadsheet that contains multiple sheets and my current goal is to be able to have an onEdit timestamp functioning on both sheets (and any future sheets that I may add) that will appear in the column (eg. if edited cell is A1, then timestamp appears in B1) next to the cell. I've had varying degrees of success by shoving scripts I found on here together in hopes that they will play nice. Currently I have it sorta working the way I want...
BUT If I delete the newly created timestamp in B1 then it will produce a new one in C1 and if I delete C1 then it appears in D1 and so on and so forth. Is there a way to prevent the timestamp from being produced up deletion of a cells contents?
function onEdit(e) {
var s = SpreadsheetApp.getActiveSheet();
var cols = [1, 3, 5]
if (s.getName() == "Sheet1")
s.getRange(e.range.rowStart, e.range.columnStart + 1)
.setValue(new Date());
if (s.getName() == "Sheet2")
s.getRange(e.range.rowStart, e.range.columnStart + 1)
.setValue(new Date());
}