Enum AuthMode Stay organized with collections Save and categorize content based on your preferences.
Page Summary
AuthMode is an enumeration in Apps Script that identifies the categories of authorized services triggered functions can execute.
AuthMode values are exposed as the
authModeproperty of the event parameterein triggered functions.You can reference an AuthMode enum by calling its parent class, name, and property, such as
ScriptApp.AuthMode.CUSTOM_FUNCTION.The AuthMode has properties like
NONE,CUSTOM_FUNCTION,LIMITED, andFULL, each representing a different level of access to authorized services.
An enumeration that identifies which categories of authorized services Apps Script is able toexecute through a triggered function. These values are exposed intriggered functions as theauthproperty of theevent parameter,e. Formore information, see theguide to theauthorization lifecycle for add-ons.
To call an enum, you call its parent class, name, and property. For example,ScriptApp.AuthMode.CUSTOM_FUNCTION.
functiononOpen(e){constmenu=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).constproperties=PropertiesService.getDocumentProperties();constworkflowStarted=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 occurswhen an add-on executes anon simple trigger, and the user has installed anadd-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 spreadsheetfunctions. Some of these services — including read-only access to Spreadsheet service —normally require authorization, but are permitted without authorization when used in a customfunction. Because custom functions do not include an event parameter, this value is neverreturned; it is documented only to demonstrate that custom functions run in their ownauthorization mode. |
LIMITED | Enum | A mode that allows access to a limited subset of services. This mode occurs when an add-on or ascriptbound to a document executes anon oron simple trigger, except in the case described forNONE. |
FULL | Enum | A mode that allows access to all services that require authorization. This mode occurs when anadd-on or a script executes as the result of any trigger other than the cases described forLIMITED orNONE. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.