Am havong some trouble creating a script to automate timestamp on GSheet. I have 2 columns - AD & AE, that I want it to have the date timestamp for when column L and AA are updated. Have tried the following script but doesn't seem to work.
function onEdit(e) {
addTimestamp(e);
}
function addTimestamp(e){
var startRow = 3;
var targetColumn = 12;
var targetColumn2 = 27;
var ws = "Brand List";
var row = e.range.getRow();
var col = e.range.getColumn();
if (col === targetColumn && row >= startRow && e.source.getActiveSheet().getName() === ws) {
var currentDate = new Date();
e.source.getActiveSheet().getRange(row,30).setValue(currentDate)
}
if (col === targetColumn2 && row >= startRow && e.source.getActiveSheet().getName() === ws) {
var currentDate = new Date();
e.source.getActiveSheet().getRange(row,31).setValue(currentDate)
}
}