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 new console, again click the on/off switch next to the service you want to use.
- Return to the script editor and click OK in the dialog. The advanced service you enabled will now be available in autocomplete.
Enabling advanced services with older scripts
By default, scripts created before July 2013 use an older version of the authorization flow. If you have not upgraded older scripts to the new authorization experience, you will need to create a project in the Google Developers Console and obtain an API key between steps 3 and 4 above. In step 5, paste the API key for your new project into the dialog before you click OK.
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.