I have been trying this for a few hours. I would like a date stamp inserted on column K when a new row is added (my data is on another sheet). I currently have the script below, however, it only works when I edit column 4 manually and not when the row is moved. I want the date stamp to be put when a new row is added. Could you please help me around this?
function onEdit() { var s = SpreadsheetApp.getActiveSheet(); if( s.getName() == "Marketing Dept" ) { //checks that we're on Sheet1 or not var r = s.getActiveCell(); if( r.getColumn() == 4 ) { //checks that the cell being edited is in column D var nextCell = r.offset(0, 7); if( nextCell.getValue() === '' ) //checks if the adjacent cell is empty or not? nextCell.setValue(new Date()); } } }