I've been using this code to find the most recent update of a given row:
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveCell();
if( r.getColumn() != 5 ) { //checks the column
var row = r.getRow();
var time = new Date();
time = Utilities.formatDate(time, "GMT-07:00", "MM-dd-yyyy HH:mm:ss");
SpreadsheetApp.getActiveSheet().getRange("E" + row.toString()).setValue(time);
};
};
The problem is that I'd like to have a header on column 'E' and I need to make sure that the script doesn't overwrite the header if someone changes something in that header row. I've tried using "E2:E" or "E2:1000" as a replacement in getRange but the effect is that when any row is updated, ALL of column E gets updated with the timestamp.
Question is: how do exclude Row 1 from being overwritten by this script?