Returns a connected advanced Google service, like BigQuery or YouTube.
class ScriptApp method .getService()
ScriptApp is the Apps Script service.
.getService() is the method name you will see after a dot in your code.
What it does
Why it's used
- Use advanced services like YouTube or Analytics from script.
- Cleaner than raw UrlFetchApp for some Google APIs.
Common errors
- Forgetting parentheses on getService. Write ScriptApp.getService(), not ScriptApp.getService or getService by itself.
- Skipping dots between chained calls. Each step needs a dot, like ScriptApp.getService().
- Adding spaces where they do not belong. Write ScriptApp.getService(), not ScriptApp .getService(), ScriptApp.getService (), or ScriptApp . getService().
- Wrong capitalization. Use ScriptApp and getService, not scriptapp or getservice.
Explore
Related methods
-
.getOAuthToken()
Returns an OAuth token for calling Google APIs as the user.
-
.getAuthorizationInfo()
Returns what permissions the script has been granted.
-
.getScriptId()
Returns the unique ID of the current script project.
-
.invalidateAuth()
Clears stored authorization so the user must approve access again.
-
.newTrigger()
Creates a new trigger that runs a function on a schedule or event.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.
Related blog posts
Written guides about ScriptApp.getService().