Run
|
|||||
|
|
Runs a function in an Apps Script project. The script project must be deployed for use with the Apps Script API and the calling application must share the same Cloud Platform project.
This method requires authorization with an OAuth 2.0 token that includes at least one of the scopes listed in the Authorization section; script projects that do not require authorization cannot be executed through this API. To find the correct scopes to include in the authentication token, open the project in the script editor, then select File > Project properties and click the Scopes tab.
The error 403, PERMISSION_DENIED: The caller does not have permission
indicates that the Cloud Platform project used to authorize the request is
not the same as the one used by the script
Authorization
To use this building block you will have to grant access to at least one of the following scopes:
- Read, compose, send, and permanently delete all your email from Gmail
- See, edit, share, and permanently delete all the calendars you can access using Google Calendar
- See, edit, download, and permanently delete your contacts
- View and manage the provisioning of groups on your domain
- View and manage the provisioning of users on your domain
- View and manage your Google Docs documents
- See, edit, create, and delete all of your Google Drive files
- View and manage your forms in Google Drive
- View and manage forms that this application has been installed in
- View and manage your Google Groups
- See, edit, create, and delete your spreadsheets in Google Drive
- View your email address
Input
This building block consumes 5 input parameters
Name | Format | Description |
---|---|---|
scriptId Required |
STRING |
The script ID of the script to be executed. To find the script ID, open the project in the script editor and select File > Project properties |
sessionState |
STRING |
Deprecated. For use with Android add-ons only. An ID that represents
the user's current session in the Android app for Google Docs or Sheets,
included as extra data in the
Intent
that launches the add-on. When an Android add-on is run with a session
state, it gains the privileges of a
bound
script—that is, it can access information like the user's current
cursor position (in Docs) or selected cell (in Sheets). To retrieve the
state, call
|
function |
STRING |
The name of the function to execute in the given script. The name does not
include parentheses or parameters. It can reference a function in an
included library such as |
devMode |
BOOLEAN |
If |
parameters[] |
ANY |
= Parameter name
= Format
scriptId STRING Required The script ID of the script to be executed. To find the script ID, open the project in the script editor and select File > Project properties |
sessionState STRING Deprecated. For use with Android add-ons only. An ID that represents
the user's current session in the Android app for Google Docs or Sheets,
included as extra data in the
Intent
that launches the add-on. When an Android add-on is run with a session
state, it gains the privileges of a
bound
script—that is, it can access information like the user's current
cursor position (in Docs) or selected cell (in Sheets). To retrieve the
state, call
|
function STRING The name of the function to execute in the given script. The name does not
include parentheses or parameters. It can reference a function in an
included library such as |
devMode BOOLEAN If |
parameters[] ANY |
Output
This building block provides 8 output parameters
Name | Format | Description |
---|---|---|
response |
OBJECT |
If the script function returns successfully, this field contains an ExecutionResponse object with the function's return value |
response.customKey.value |
ANY |
If the script function returns successfully, this field contains an ExecutionResponse object with the function's return value |
error |
OBJECT |
If a |
error.code |
INTEGER |
The status code. For this API, this value either:
|
error.message |
STRING |
A developer-facing error message, which is in English. Any user-facing error message is localized and sent in the details field, or localized by the client |
error.details[] |
OBJECT |
|
error.details[].customKey.value |
ANY |
|
done |
BOOLEAN |
This field indicates whether the script execution has completed. A completed execution has a populated |
= Parameter name
= Format
response OBJECT If the script function returns successfully, this field contains an ExecutionResponse object with the function's return value |
response.customKey.value ANY If the script function returns successfully, this field contains an ExecutionResponse object with the function's return value |
error OBJECT If a |
error.code INTEGER The status code. For this API, this value either:
|
error.message STRING A developer-facing error message, which is in English. Any user-facing error message is localized and sent in the details field, or localized by the client |
error.details[] OBJECT |
error.details[].customKey.value ANY |
done BOOLEAN This field indicates whether the script execution has completed. A completed execution has a populated |