This does the job. Notice I've slightly modified it to enter a timestamp in column J, if input was recorded in column 6, 7, 8, 9
Is there a range function in Javascript like in Python?
Instead of using ||
is there something like range(6, 10)
?
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Projects" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 6 || r.getColumn() == 7 || r.getColumn() == 8 || r.getColumn() == 9 ) { //checks the column
// var nextCell = r.offset(0,2);
var nextCell = SpreadsheetApp.getActiveSheet().getRange('J' + r.getRow());
// if( nextCell.getValue() === '' ) //is empty?
nextCell.setValue(new Date());
}
}
}