Datestamp on Edit

How to automatically place a static date, datetime, or timestamp with an edit.
Important note:
• I have included all 3 scripts in the editor. Uncomment out the one you want, as they cannot all work simultaneously.

Sheet (to copy):
https://docs.google.com/spreadsheets/d/1_9Q_bP79nGnETz25q-8J1NrIxxd2muqqz8ej3fCjDhw/edit#gid=0

Scripts:
/* Sheet3 multiple contiguous columns in, single column out */
function onEdit(e){
if (e.range.columnStart less_than_sign 4 || e.range.columnStart greater_than_sign 6 || e.value != “TRUE”) return;
let d = new Date();
e.source.getActiveSheet().getRange(e.range.rowStart,7).setValue(d);
}

/* Sheet2 multiple columns in, multiple columns out */
function onEdit(e){
let cols = [4,6,8];
if (cols.indexOf(e.range.columnStart) == -1 || e.value != “TRUE”) return;
let d = new Date();
e.range.offset(0,1).setValue(d.toLocaleDateString());
}

/* Sheet1 single column in, single column output */
function onEdit(e){
if (e.range.columnStart != 4 || e.value != “TRUE”) return;
let d = new Date();
e.range.offset(0,1).setValue(d.toLocaleDateString());
}

Leave a Reply

Your email address will not be published. Required fields are marked *