Google Apps Script: Authorization is required to perform that action

Is your Google Apps Script throwing the following Error Message?

Authorization is required to perform that action.

Then you might have to set the Authorization Scopes in the manifest.

  • Open the script project in the Apps Script editor.
  • In the menu, select File > Project properties.
  • Select the Scopes tab.
  • Review the scopes your script currently requires and determine what changes need to be made. Click Cancel when finished.
  • If the manifest file appsscript.json isn't visible in the left nav bar, select the View > Show manifest file menu item.
  • Select the appsscript.json file in the left nav to open it.
  • Locate the top-level field labeled oauthScopes. If it is not present, you can add it.
  • The oauthScopes field specifies an array of strings. To set the scopes your project uses, replace the contents of this array with the scopes you want it to use. For example:

{
  "timeZone": "Australia/Sydney",
   "oauthScopes": [
    "https://mail.google.com/",
    "https://www.googleapis.com/auth/script.container.ui",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/spreadsheets.currentonly"
  ],
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER"
}
  • Save the manifest file using Ctrl+S or the Save file icon in the menu bar.