Google Apps Script is Google's cloud-based JavaScript platform for automating and extending Google Workspace apps such as Sheets, Docs, Drive and Gmail. The UnifyApps Google Apps Script connector uses the Apps Script API to run a function in one of your deployed Apps Script projects, with the parameters you pass, and return its result to your workflows.
This guide covers every authentication type available on the connection form, and the actions supported, along with the Google scope each one needs.
Authentication
Before you begin, you should have the following information:
Connection name: a descriptive name such as MyAppGoogleAppsScriptIntegration, so the connection is easy to identify later.
Authentication type: Google Apps Script connects only through your own Google Cloud OAuth client, so the form has no authentication type to select:
OAuth
The Apps Script API only runs a script when the OAuth client that calls it belongs to the same standard Google Cloud project as the script, and when the token covers every scope the script uses. That is why this connector needs your own OAuth client rather than a pre-configured one.
1. OAuth
Use this to run functions from an Apps Script project as the Google user who signs in. Apps Script does not support service accounts for this API.
Step 1: Link the script to a standard Google Cloud project
In the Google Cloud Console, select or create a standard project and copy its Project number from the project dashboard.
Go to APIs & Services → Library, search for Apps Script API and click Enable.
Open your Apps Script project. At the left, click Project Settings, and under Google Cloud Project click Change project. Enter the project number and click Set project.
At the left, click Overview and note every scope listed under Project OAuth scopes. The connection needs all of them, not only the ones used by the function you call.
Step 2: Create an OAuth client in Google Cloud
In the same Google Cloud project, go to Google Auth platform → Branding. If you see Google Auth platform not configured yet, click Get Started, enter an App name, User support email, Audience and contact email, and click Create.
Go to Data Access, click Add or Remove Scopes, add the script's Project OAuth scopes, and click Save. If the audience is External, add the users who will sign in under Audience → Test users.
Go to Google Auth platform → Clients and click Create Client. Choose Web application as the Application type and enter a name.
Under Authorized redirect URIs, click Add URI and paste the Callback URL shown on the UnifyApps connection form (it is copyable and differs per environment).
Click Create, then copy the Client ID and Client secret. Copy the secret immediately: Google shows it only once.
Step 3: Deploy the script as an API executable
In the Apps Script editor, click Deploy → New deployment.
Next to Select type, click Enable deployment types and select API Executable.
Enter a description, choose who has access, and click Deploy.
Copy the Deployment ID. The Run function action uses it to call the deployed version. In development mode, the action uses the Script ID (under Project Settings → IDs) and runs the most recently saved code instead; only the script owner can run a script in development mode.
Step 4: Connection setup in UnifyApps
Open Connections → New Connection → Google Apps Script and enter a Connection name.
Enter the Client ID and Client secret copied from Google Cloud.
In Scopes, select the scopes the script uses from the list.
Optionally, in Project OAuth scopes, enter any script scopes that are not in the Scopes list. The connection requests the scopes from both fields together.
Click Authorize, sign in with Google and click Allow on the consent screen.
Confirm the success message after the redirect back to UnifyApps.
Actions
Actions | Description | Scopes Required |
|---|---|---|
| Runs a function in a Google Apps Script project. | Every scope listed under the script's Project OAuth scopes (the Apps Script API needs at least one of its listed scopes, and the script needs all of its own) |