The advanced services in Apps Script allow experienced developers to connect to certain public Google APIs with less set-up than using their HTTP interfaces. They work much like Apps Script's built-in services — for example, they offer autocomplete, and Apps Script handles the authorization flow automatically — but are not enabled by default.
To see which Google APIs are available as advanced services, look for the "Advanced Google Services" section in the Reference. If you want to use a Google API that isn't available as an advanced service, just connect to it like any other external API.
Enabling advanced services requires that you have access to the script's Cloud Platform project. When you collaborate on a project in Team Drives, your access to the Cloud Platform project may be restricted; see the Cloud Project and Team Drives guide section for details.
You may wish to switch the Apps Script to use a standard Cloud Platform project in order to have direct access to the API monitoring information in the API manager dashboard. Doing so also ensures you and your collaborators have access to the Cloud Platform project settings while the script resides in a Team Drive.
Enabling advanced services
To use an advanced Google service, follow these instructions:
- In the script editor, select Resources > Advanced Google services....
- In the dialog that appears, click the on/off switch next to the service you want to use.
- At the bottom of the dialog, click the link for the Google API Console.
- In the console, click into the filter box and type part of the name of the API (for example, "Calendar"), then click the name once you see it.
- On the next screen, click Enable API.
- Close the Developers Console and return to the script editor. Click OK in the dialog. The advanced service you enabled is now available in autocomplete.
How method signatures are determined
Advanced services generally use the same objects, method names, and parameters as the corresponding public APIs, although method signatures are translated for use in Apps Script. The script editor's autocomplete function usually provides enough information to get started, but the rules below explain how Apps Script generates a method signature from a public Google API.
Requests to Google APIs can accept a variety of different types of data, including path parameters, query parameters, a request body, and/or a media upload attachment. The corresponding method signature in Google Apps Script has the following arguments:
- Path or required parameters, as individual arguments.
- The media upload attachment, as a
If the method doesn't have any items in a given category, that part of the signature is omitted.
There are some special exceptions to be aware of:
- For methods that accept a media upload, the parameter
uploadTypeis set automatically.
- Methods named
deletein the Google API are named
removein Apps Script, since