Wolfram
Wolfram

Reputation: 5

CalendarApp.getDefaultCalendar() authorization

I wrote a script in a spreadsheet, which shall create a calender event. Coming down to the statement

var cal = CalendarApp.getDefaultCalendar();

I get the error "Authorization failed" ( Ausführung fehlgeschlagen: Sie haben nicht die erforderliche Berechtigung zum Aufruf von getDefaultCalendar. (line 107, file "Kopie von Code") [0.171 Sekunden Laufzeit insgesamt] )

What can I do to get this authorization? I'm the same user on the Google Drive and Google Calendar.

Upvotes: 0

Views: 875

Answers (1)

Daniel Bank
Daniel Bank

Reputation: 3899

From Google App Script's Troubleshooting section:

Authorization is required to perform that action. This error indicates that the script is lacking the authorization needed to run. When a script is run in the Script Editor or from a custom menu item an authorization dialog is presented to the user. However, when a script is run as a service, embedded with a Google Sites page, or run from a trigger the dialog cannot be presented and this error is shown. To authorize the script, open the Script Editor and run any function. To avoid this error, remember to run the script once in the Script Editor after adding new services or capabilities to your script.

Just run any one function of your script from the Run menu and the Script Editor should present the dialog to grant authorization. After that your script should work.

Running a function from the Run Menu

Upvotes: 1

Related Questions