3
votes

I've built a Google Script which runs when my Spreadsheet is edited:

function onEdit(event)
{
  Browser.msgBox(event.source);
  general(event);
}

When my function is named onEdit(), the Browser.msgBox returns "Spreadsheet" (so the source is defined) When my function is named othername(), the Browser.msgBox retunrs "undefined".

I execute the script with the same user, the script runs when my Spreadsheet is edited and i don't change anything else than the name of the function.

Thanks.

2

2 Answers

1
votes

onEdit is an event in Google Script, so changing it's name will generate different behavior. Hope this helps!

0
votes

event.source stays undefined when you use another function than onEdit().

I've replaced event.source by event.range and now it works.

I don't understand why but it runs.