How should I modify the script, in a way that it would work also in another column, eg. by putting data in A:A date will be printed in B:B and also in C:C
function onEdit() {
var sheetName = "MySheet";
var s = SpreadsheetApp.getActiveSheet();
if (s.getName() !== sheetName) return;
var r = s.getActiveCell();
if( r.getColumn() != 2 ) { //checks the column
var row = r.getRow();
var time = new Date();
time = Utilities.formatDate(time, "GMT+05:30", "dd-MM-yyyy, hh:mm a");
SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);
};
};
Best Answer
try this: