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 under the "Reference" header in the sidebar of this site. 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
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 Developers 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 will now be 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:
- The request body (usually a resource), as a JavaScript object.
- Path or required parameters, as individual arguments.
- The media upload attachment, as a
Blob
argument. - Optional parameters, as a JavaScript object mapping parameter names to values.
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
uploadType
is set automatically. - Methods named
delete
in the Google API are namedremove
in Apps Script, sincedelete
is a reserved word in JavaScript.