Google Sheets OnEdit() - You do not have permission to call a service
The onEdit()
will have to be an Installable Trigger because it is using a service that requires authorization.
note: rename onEdit()
when using it as an installable trigger to avoid possible issues
Like simple triggers, installable triggers let Apps Script run a function automatically when a certain event, such as opening a document, occurs. Installable triggers, however, offer more flexibility than simple triggers: they can call services that require authorization, ...
Managing triggers manually:
To manually create an installable trigger through a dialog in the script editor, follow these steps:
- From the script editor, choose Edit > Current project's triggers.
- Click the link that says: No triggers set up. Click here to add one now.
- Under Run, select the name of function you want to trigger.
- Under Events, select either Time-driven or the Google App that the script is bound to (for example, From spreadsheet).
- Select and configure the type of trigger you want to create (for example, an Hour timer that runs Every hour or an On open trigger).
- Optionally, click Notifications to configure how and when you will be contacted by email if your triggered function fails.
- Click Save.