Script not working

23 views
Skip to first unread message

Beresfords Solicitors

unread,
Sep 2, 2022, 9:05:28 AM9/2/22
to Google Apps Script Community
I have copied a script from a YouTube video but I can't get it to work. I don't think there is anything wrong with the code, I think it is about activating it. 

It is just a script to put a date in column 5 when a value is updated in that row.

function OnEdit(e) {
  var row = e.range.getRow();
  e.source.getActiveSheet().getRange(row,5).setValue(new Date());
}

I put it in from the Google Sheet using the menu command: Extensions - AppScript.
I pressed save. When I go back to the spreadsheet, what do I need to do to activate the script?

Sorry, I know that's a basic one, I have looked around but can't find anything basic enough.

Thanks.

Ben Ronkin

unread,
Sep 2, 2022, 9:39:36 AM9/2/22
to Google Apps Script Community
The function should be named onEdit (with a lowercase o), not OnEdit. If you change to a lowercase o then the function works as expected.
Reply all
Reply to author
Forward
0 new messages