1. Add library and Gmail service - NoSubstitute/userDelegationWebApp GitHub Wiki

Add library - not necessary if you copy the template

Open your Google Apps Script project and click Libraries to add a new library.

Add library step 1

Enter the following Script ID / Library ID: (triple-click to select all of it) 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF

Paste the id in the Script ID field, and click Look up.

image

Use the latest version of the library (41 or more). Don't change the identifier, as that is how you refer to the library in your script.

Click Add to add the library to your script.

Add Gmail advanced service - not necessary if you copy the template

Click Services to add a new service. Scroll down and select Gmail API. ADD

image

Add scopes to the appsscript.json file - not necessary if you copy the template

Open the script project settings (the cog in the left menu). Tick the box for Show "appsscript.json" manifest file in editor. Open the Editor and the appsscript.json file.

Adjust the text at the bottom from this.

"exceptionLogging": "STACKDRIVER", "runtimeVersion": "V8"

To this.

"exceptionLogging": "STACKDRIVER", "oauthScopes": ["https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/gmail.settings.basic", "https://www.googleapis.com/auth/gmail.settings.sharing", "https://www.googleapis.com/auth/script.external_request"], "runtimeVersion": "V8"

While you are in the appsscript.json file you could change the timeZone, so the log will better reflect your local time.

Next step