Stay organized with collections Save and categorize content based on your preferences.
AuthModeAn enumeration that identifies which categories of authorized services Apps Script is able to execute through a triggered function. These values are exposed in triggered functions as the authMode
property of the event parameter, e
. For more information, see the guide to the authorization lifecycle for add-ons.
To call an enum, you call its parent class, name, and property. For example, ScriptApp.AuthMode.CUSTOM_FUNCTION
.
function onOpen(e) { const menu = SpreadsheetApp.getUi().createAddonMenu(); if (e && e.authMode === ScriptApp.AuthMode.NONE) { // Add a normal menu item (works in all authorization modes). menu.addItem('Start workflow', 'startWorkflow'); } else { // Add a menu item based on properties (doesn't work in AuthMode.NONE). const properties = PropertiesService.getDocumentProperties(); const workflowStarted = properties.getProperty('workflowStarted'); if (workflowStarted) { menu.addItem('Check workflow status', 'checkWorkflow'); } else { menu.addItem('Start workflow', 'startWorkflow'); } // Record analytics. UrlFetchApp.fetch('http://www.example.com/analytics?event=open'); } menu.addToUi(); }Properties Property Type Description
NONE
Enum
A mode that does not allow access to any services that require authorization. This mode occurs when an add-on executes an onOpen(e)
simple trigger, and the user has installed an add-on in a different document but the add-on has not been used in the current document. CUSTOM_FUNCTION
Enum
A mode that allows access to a limited subset of services for use in custom spreadsheet functions. Some of these services — including read-only access to Spreadsheet service — normally require authorization, but are permitted without authorization when used in a custom function. Because custom functions do not include an event parameter, this value is never returned; it is documented only to demonstrate that custom functions run in their own authorization mode. LIMITED
Enum
A mode that allows access to a limited subset of services. This mode occurs when an add-on or a script bound to a document executes an onOpen(e)
or onEdit(e)
simple trigger, except in the case described for NONE
. FULL
Enum
A mode that allows access to all services that require authorization. This mode occurs when an add-on or a script executes as the result of any trigger other than the cases described for LIMITED
or NONE
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["AuthMode defines the level of access Apps Script has to authorized services when a triggered function is executed."],["It's crucial for understanding how add-ons and scripts interact with Google services, especially concerning user authorization."],["Different AuthModes like NONE, LIMITED, and FULL, dictate the scope of service access, impacting functionalities within triggered functions."],["Custom functions operate under a specific authorization mode that allows restricted access to certain services without explicit user authorization."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4