1

I had some code in script that was working fine and now for some reason it's now giving me the error int he title of this question

The code is as follows

    function onEdit(e) {
        var sheet = e.source.getActiveSpreadsheet(),
       columnToWatch = 10,
       columnToStamp = 9, //change all of these to your needs...1 is column A, 2 is column B, etc
       excluded = ["KEY CODE","Form Responses 1","Hub List"]; //add names of sheets/tabs to this 
       list. The script will not work on these sheets.
       if (e.source.columnStart !== columnToWatch ||  !e.value || excluded.indexOf(sheet.getName()) 
       > -1) return;
    sheet.getRange(e.source.rowStart, columnToStamp)
        .setValue(new Date()).setNumberFormat("dd.MM.yy");  

}

Any help would be aprecciated!

  • Would you mind sharing a redacted version of your sheet so we could provide with a more reliable solution based on your use case? – Sourabh Choraria Oct 07 '19 at 10:02
  • 1
    If you run this code from the editor it will always produce this error, `e` is an [event object](https://developers.google.com/apps-script/guides/triggers/events#google_sheets_events), it only exists as a result of an event (an edit in this case). – AMolina Oct 07 '19 at 11:22

0 Answers0