Reputation: 31
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.
Upvotes: 3
Views: 2056
Reputation: 31
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.
Upvotes: 0
Reputation: 1634
onEdit
is an event in Google Script, so changing it's name will generate different behavior.
Hope this helps!
Upvotes: 1