/** Module: ScriptApp */ type ScriptApp = typeof ScriptApp; declare namespace ScriptApp { /** * Removes the given trigger so it no longer runs. * *

	 * // Deletes all triggers in the current project.
	 * var triggers = ScriptApp.getProjectTriggers();
	 * for (var i = 0; i < triggers.length; i++) {
	 *   ScriptApp.deleteTrigger(triggers[i]);
	 * }
	 * 
* * @param trigger - The trigger to delete. */ function deleteTrigger( trigger: ScriptApp.Trigger ): void /** * Gets an object used to determine whether the user needs to authorize this script to use one or * more services, and to provide the URL for an authorization dialog. If the script is published * as an add-on that uses installable triggers, this information can be * used to control access to sections of code for which the user lacks the necessary * authorization. Alternately, the add-on can ask the user to open the URL for the authorization * dialog to resolve the problem. * *

	 * var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL);
	 * status = authInfo.getAuthorizationStatus();
	 * url = authInfo.getAuthorizationUrl();
	 * 
* * @param authMode - the authorization mode for which authorization information is requested; in * almost all cases, the value for authMode should be ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL), since no other authorization mode * requires that users grant authorization * * @returns an object that can provide information about the user's authorization status */ function getAuthorizationInfo( authMode: ScriptApp.AuthMode ): ScriptApp.AuthorizationInfo /** * Gets an OpenID Connect identity token for the * effective user, if the openid scope has been granted. This scope is not included * by default, and you must add it as an explicit scope in the manifest * file to request it. Include the scopes https://www.googleapis.com/auth/userinfo.email * or https://www.googleapis.com/auth/userinfo.profile to return additional * user information in the token. * *

The returned ID token is an encoded JSON Web Token (JWT), and * it must be decoded to extract information from it. The following examples shows how to decode * the token and extract the effective user's Google profile ID. * *


	 * var idToken = ScriptApp.getIdentityToken();
	 * var body = idToken.split('.')[1];
	 * var decoded = Utilities.newBlob(Utilities.base64Decode(body)).getDataAsString();
	 * var payload = JSON.parse(decoded);
	 * var profileId = payload.sub;
	 * Logger.log('Profile ID: ' + profileId);
	 * 
* * See the OpenID Connect * documentation for the full list of fields (claims) returned. * * @returns The identity token if available; otherwise null. */ function getIdentityToken(): string /** * Returns an enum value that indicates how the script came to be installed as an add-on for the * current user (for example, whether the user installed it personally through the Chrome Web * Store, or whether a domain administrator installed it for all users). * * @returns The source of installation. */ function getInstallationSource(): ScriptApp.InstallationSource /** * Gets the OAuth 2.0 access token * for the effective user. If the script's OAuth scopes are sufficient to authorize another Google * API that normally requires its own OAuth flow (like Google Picker), scripts can bypass the * second authorization prompt by passing this token instead. The token expires after a time (a * few minutes at minimum); scripts should handle authorization failures and call this method to * obtain a fresh token when needed. * *

The token returned by this method only includes scopes that the script currently needs. * Scopes that were previously authorized but are no longer used by the script are not included in * the returned token. If additional OAuth scopes are needed beyond what the script itself * requires, they can be specified in the script's * manifest file. * * @returns A string representation of the OAuth 2.0 token. */ function getOAuthToken(): string /** * Gets the project key of the current script. The project key is a unique identifier for scripts * and used to compose the callback URL used in conjunction with newStateToken(). * *

When called in a library, this returns the * project key of the outer-most script being executed. * * @returns The project key of the current script. */ function getProjectKey(): string /** * Gets all installable triggers associated with the current project and current user. * *


	 * Logger.log('Current project has ' + ScriptApp.getProjectTriggers().length + ' triggers.');
	 * 
* * @returns An array of the current user's triggers associated with this project. */ function getProjectTriggers(): ScriptApp.Trigger[] /** * Gets the script project's unique ID. This is the preferred method to get the unique identifier * for the script project as opposed to getProjectKey(). This ID can be used in all places * where project key was previously provided. * * @returns The script project's ID. */ function getScriptId(): string /** * Gets all installable triggers associated with the current project and current user. * *

	 * Logger.log('Current script has ' + ScriptApp.getScriptTriggers().length + ' triggers.');
	 * 
* * @returns An array of the current user's triggers associated with this project. */ function getScriptTriggers(): ScriptApp.Trigger[] /** * Gets an object used to control publishing the script as a web app. * *

	 * // Get the URL of the published web app.
	 * var url = ScriptApp.getService().getUrl();
	 * 
* * @returns An object used to observe and control publishing the script as a web app. */ function getService(): ScriptApp.Service /** * Gets all installable triggers owned by this user in the given document, for this script or * add-on only. This method cannot be used to see the triggers attached to other scripts. * *

	 * var doc = DocumentApp.getActiveDocument();
	 * var triggers = ScriptApp.getUserTriggers(doc);
	 * // Log the handler function for the first trigger in the array.
	 * Logger.log(triggers[0].getHandlerFunction());
	 * 
* * @param document - A Google Docs file that may contain installable triggers. * * @returns An array of triggers owned by this user in the given document. */ function getUserTriggers( document: DocumentApp.Document ): ScriptApp.Trigger[] /** * Gets all installable triggers owned by this user in the given form, for this script or add-on * only. This method cannot be used to see the triggers attached to other scripts. * *

	 * var form = FormApp.getActiveForm();
	 * var triggers = ScriptApp.getUserTriggers(form);
	 * // Log the trigger source for the first trigger in the array.
	 * Logger.log(triggers[0].getTriggerSource());
	 * 
* * @param form - A Google Forms file that may contain installable triggers. * * @returns An array of triggers owned by this user in the given form. */ function getUserTriggers( form: FormApp.Form ): ScriptApp.Trigger[] /** * Gets all installable triggers owned by this user in the given spreadsheet, for this script or * add-on only. This method cannot be used to see the triggers attached to other scripts. * *

	 * var ss = SpreadsheetApp.getActiveSpreadsheet();
	 * var triggers = ScriptApp.getUserTriggers(ss);
	 * // Log the event type for the first trigger in the array.
	 * Logger.log(triggers[0].getEventType());
	 * 
* * @param spreadsheet - A Google Sheets file that may contain installable triggers. * * @returns An array of triggers owned by this user in the given spreadsheet. */ function getUserTriggers( spreadsheet: SpreadsheetApp.Spreadsheet ): ScriptApp.Trigger[] /** * Invalidates the authorization the effective user has to execute the current script. Used to * invalidate any permissions for the current script. This is especially useful for functions * tagged as one-shot authorization. Since one-shot authorization functions can only be called the * first run after the script has acquired authorization, if you wish to perform an action * afterwards, you must revoke any authorization the script had, so the user can see the * authorization dialog again. * *

	 * ScriptApp.invalidateAuth();
	 * 
*/ function invalidateAuth(): void /** * Creates a builder for a state token that can be used in a callback API (like an OAuth flow). * *

	 * // Generate a callback URL, given the name of a callback function. The script does not need to
	 * // be published as a web app; the /usercallback URL suffix replaces /edit in any script's URL.
	 * function getCallbackURL(callbackFunction) {
	 *   // IMPORTANT: Replace string below with the URL from your script, minus the /edit at the end.
	 *   var scriptUrl = 'https://script.google.com/macros/d/1234567890abcdefghijklmonpqrstuvwxyz';
	 *   var urlSuffix = '/usercallback?state=';
	 *   var stateToken = ScriptApp.newStateToken()
	 *       .withMethod(callbackFunction)
	 *       .withTimeout(120)
	 *       .createToken();
	 *   return scriptUrl + urlSuffix + stateToken;
	 * }
	 * 
* *

In most OAuth2 flows, the state token is passed to the authorization endpoint * directly (not as part of the callback URL), and the authorization endpoint then passes it as * part of the callback URL. * *

For example: * *

* * @returns An object used to continue the state-token-building process. */ function newStateToken(): ScriptApp.StateTokenBuilder /** * Begins the process of creating an installable trigger that, when fired, calls a given function. * *

	 * // Creates an edit trigger for a spreadsheet identified by ID.
	 * ScriptApp.newTrigger('myFunction')
	 *     .forSpreadsheet('1234567890abcdefghijklmnopqrstuvwxyz_a1b2c3')
	 *     .onEdit()
	 *     .create();
	 * 
* * @param functionName - The function to call when the trigger fires. You can use functions from * included libraries, such as Library.libFunction1. * * @returns An object used to continue the trigger-building process. */ function newTrigger( functionName: string ): ScriptApp.TriggerBuilder enum AuthMode { /** * 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. */ CUSTOM_FUNCTION = "CUSTOM_FUNCTION", /** * 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. */ FULL = "FULL", /** * 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. */ LIMITED = "LIMITED", /** * 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. */ NONE = "NONE", } class AuthorizationInfo { private constructor(); /** * Gets a value that indicates whether the user needs to authorize this script to use one or more * services (for example, ScriptApp.AuthorizationStatus.REQUIRED). * *

		 * // Log the authorization status (REQUIRED or NOT_REQUIRED).
		 * var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL);
		 * Logger.log(authInfo.getAuthorizationStatus());
		 * 
* * @returns the authorization status */ getAuthorizationStatus(): ScriptApp.AuthorizationStatus /** * Gets the authorization URL that can be used to grant access to the script. This method returns * null if no authorization is required. The page at the URL will close automatically if * it is accessed and the script does not require any authorization. * *

		 * // Log the URL used to grant access to the script.
		 * var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL);
		 * Logger.log(authInfo.getAuthorizationUrl());
		 * 
* * @returns a URL that can be used to authorize the script */ getAuthorizationUrl(): string } enum AuthorizationStatus { /** * The user has granted this script all the authorization it currently requires. */ NOT_REQUIRED = "NOT_REQUIRED", /** * The user needs to authorize this script to use one or more services. In most cases, the script * prompts the user for authorization the next time it runs; however, if the script is published * as an add-on that uses installable triggers, the trigger runs the * script without prompting for authorization but throws an exception if the script attempts to * call the unauthorized service. */ REQUIRED = "REQUIRED", } class CalendarTriggerBuilder { private constructor(); /** * Creates the trigger and returns it. * * @returns The new trigger. */ create(): ScriptApp.Trigger /** * Specifies a trigger that fires when a calendar entry is created, updated, or deleted. * * @returns This CalendarTriggerBuilder, for chaining. */ onEventUpdated(): ScriptApp.CalendarTriggerBuilder } class ClockTriggerBuilder { private constructor(); /** * Specifies the minimum duration (in milliseconds) after the current time that the trigger runs. * The actual duration might vary, but won't be less than your specified minimum. * *

		 * // Creates a trigger that runs 10 minutes later
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .after(10 * 60 * 1000)
		 *   .create();
		 * 
* * @param durationMilliseconds - The minimum duration (in milliseconds) after the current time when * the trigger should run. * * @returns The builder, for chaining. */ after( durationMilliseconds: number ): ScriptApp.ClockTriggerBuilder /** * Specifies when the trigger runs. * *

		 * // Creates a trigger for December 1, 2012
		 * var triggerDay = new Date(2012, 11, 1);
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .at(triggerDay)
		 *   .create();
		 * 
* * @param date - A Date object representing when the trigger should run. * * @returns The builder, for chaining. */ at( date: Date ): ScriptApp.ClockTriggerBuilder /** * Specifies that the trigger fires on the given date, by default near midnight (+/- 15 minutes). * *

		 * // Schedules for January 1st, 2013
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .atDate(2013, 1, 1)
		 *   .create();
		 * 
* * @param year - The calendar year to schedule the trigger. * @param month - The calendar month to schedule the trigger (should be a number between 1 and 12, * inclusive). * @param day - The calendar day to schedule the trigger (should be a number between 1 and 31, * inclusive). * * @returns The builder, for chaining. */ atDate( year: number, month: number, day: number ): ScriptApp.ClockTriggerBuilder /** * Specifies the hour the trigger at which the trigger runs. * *

		 * // Runs between 5am-6am in the timezone of the script
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .atHour(5)
		 *   .everyDays(1) // Frequency is required if you are using atHour() or nearMinute()
		 *   .create();
		 * 
* * @param hour - The hour at which to fire. * * @returns The builder, for chaining. */ atHour( hour: number ): ScriptApp.ClockTriggerBuilder /** * Creates the trigger. * * @returns The newly created, scheduled trigger. */ create(): ScriptApp.Trigger /** * Specifies to run the trigger every n days. * *

		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .everyDays(3)
		 *   .create();
		 * 
* * @param n - The number of days between executions. * * @returns The builder, for chaining. */ everyDays( n: number ): ScriptApp.ClockTriggerBuilder /** * Specifies to run the trigger every n hours. * *

		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .everyHours(12)
		 *   .create();
		 * 
* * @param n - The number of hours between executions. * * @returns The builder, for chaining. */ everyHours( n: number ): ScriptApp.ClockTriggerBuilder /** * Specifies to run the trigger every n minutes. n must be 1, 5, 10, 15 or 30. * *

		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .everyMinutes(10)
		 *   .create();
		 * 
* * @param n - The number of minutes between executions. * * @returns The builder, for chaining. */ everyMinutes( n: number ): ScriptApp.ClockTriggerBuilder /** * Specifies to run the trigger every n weeks. * *

		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .everyWeeks(2)
		 *   .create();
		 * 
* * @param n - The number of weeks between executions. * * @returns The builder, for chaining. */ everyWeeks( n: number ): ScriptApp.ClockTriggerBuilder /** * Specifies the timezone for the specified dates/time when the trigger runs. By default, the * timezone is that of the script. * *

The list of valid timezone strings corresponds with the valid timezone strings listed by Joda.org. An invalid timezone string * causes the script to throw an error. * *


		 * // Schedule the trigger to execute at noon every day in the US/Pacific time zone
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .atHour(12)
		 *   .everyDays(1)
		 *   .inTimezone("America/Los_Angeles")
		 *   .create();
		 * 
* * @param timezone - The timezone with which to treat time information in the event. * * @returns This ClockTriggerBuilder, for chaining. */ inTimezone( timezone: string ): ScriptApp.ClockTriggerBuilder /** * Specifies the minute at which the trigger runs (plus or minus 15 minutes). If nearMinute() is not called, a random minute value is used. * *

		 * // Runs at approximately 5:30am in the timezone of the script
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .atHour(5)
		 *   .nearMinute(30)
		 *   .everyDays(1) // Frequency is required if you are using atHour() or nearMinute()
		 *   .create();
		 * 
* * @param minute - The minute at which to fire. * * @returns The builder, for chaining. */ nearMinute( minute: number ): ScriptApp.ClockTriggerBuilder /** * Specifies the date in the month that the trigger runs. * *

		 * // Schedules for the first of every month
		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .onMonthDay(1)
		 *   .create();
		 * 
* * @param day - The day of the month the trigger should be scheduled for. * * @returns The builder, for chaining. */ onMonthDay( day: number ): ScriptApp.ClockTriggerBuilder /** * Specifies the day of the week that the trigger runs. * *

		 * ScriptApp.newTrigger("myFunction")
		 *   .timeBased()
		 *   .onWeekDay(ScriptApp.WeekDay.FRIDAY)
		 *   .create();
		 * 
* * @param day - The day of the week to fire. * * @returns The builder, for chaining. */ onWeekDay( day: Weekday ): ScriptApp.ClockTriggerBuilder } class DocumentTriggerBuilder { private constructor(); /** * Creates and returns the new trigger. * * @returns The new trigger. */ create(): ScriptApp.Trigger /** * Specifies a trigger that will fire when the document is opened. * *

		 * var document = DocumentApp.getActiveDocument();
		 * ScriptApp.newTrigger('myFunction')
		 *   .forDocument(document)
		 *   .onOpen()
		 *   .create();
		 * 
* * @returns This DocumentTriggerBuilder, for chaining. */ onOpen(): ScriptApp.DocumentTriggerBuilder } enum EventType { /** * The trigger fires once the time-driven event reaches a specific time. */ CLOCK = "CLOCK", /** * The trigger fires once the user changes the Google Sheets file (for example, by adding a row, * which counts as a change instead of an edit). */ ON_CHANGE = "ON_CHANGE", /** * The trigger fires once the user edits the Google Sheets file (for example, by entering a new * value into a cell, which counts as an edit instead of a change). */ ON_EDIT = "ON_EDIT", /** * The trigger fires once an event gets created, updated, or deleted on the specified Google * Calendar. */ ON_EVENT_UPDATED = "ON_EVENT_UPDATED", /** * The trigger fires once the user responds to a Google Form. This trigger is available either in * the Google Form itself or in the Google Sheets file that the form sends its responses to. */ ON_FORM_SUBMIT = "ON_FORM_SUBMIT", /** * The trigger fires once the user opens the Google Docs, Sheets, or Forms file. */ ON_OPEN = "ON_OPEN", } class FormTriggerBuilder { private constructor(); /** * Creates and returns the new trigger. * * @returns The new trigger. */ create(): ScriptApp.Trigger /** * Specifies a trigger that will fire when a response is submitted to the form. * *

		 * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
		 * ScriptApp.newTrigger('myFunction')
		 *     .forForm(form)
		 *     .onFormSubmit()
		 *     .create();
		 * 
* * @returns this FormTriggerBuilder, for chaining */ onFormSubmit(): ScriptApp.FormTriggerBuilder /** * Specifies a trigger that will fire when the form's edit view is opened. * *

		 * var form = FormApp.getActiveForm();
		 * ScriptApp.newTrigger('myFunction')
		 *     .forForm(form)
		 *     .onOpen()
		 *     .create();
		 * 
* * @returns This FormTriggerBuilder, for chaining. */ onOpen(): ScriptApp.FormTriggerBuilder } enum InstallationSource { /** * Add-on was installed by the administrator for the user's domain. */ APPS_MARKETPLACE_DOMAIN_ADD_ON = "APPS_MARKETPLACE_DOMAIN_ADD_ON", /** * Script is not running as an add-on. */ NONE = "NONE", /** * Add-on was installed by the user from the Chrome Web Store. */ WEB_STORE_ADD_ON = "WEB_STORE_ADD_ON", } class Service { private constructor(); /** * Disables the script from being accessed as a web app. This method is equivalent to opening the * "Publish > Deploy as web app" dialog and clicking "disable web app". * *

		 * ScriptApp.getService().disable();
		 * 
*/ disable(): void /** * Returns the URL of the web app, if it has been deployed; otherwise returns null. If you * are running the development mode web app, this returns the development mode url. * *

		 * // Mail the URL of the published web app.
		 * MailApp.sendMail("myself@example.com", "My Snazzy App",
		 *   "My new app is now available at " + ScriptApp.getService().getUrl());
		 * 
* * @returns the URL of the web app */ getUrl(): string /** * Returns true if the script is accessible as a web app. * * @returns true if the script is published as a web app; false if not */ isEnabled(): Boolean } class SpreadsheetTriggerBuilder { private constructor(); /** * Creates the trigger and returns it. * * @returns The created trigger. */ create(): ScriptApp.Trigger /** * Specifies a trigger that will fire when the spreadsheet's content or structure is changed. * *

		 * var sheet = SpreadsheetApp.getActive();
		 * ScriptApp.newTrigger("myFunction")
		 *   .forSpreadsheet(sheet)
		 *   .onChange()
		 *   .create();
		 * 
* * @returns a builder for chaining */ onChange(): ScriptApp.SpreadsheetTriggerBuilder /** * Specifies a trigger that will fire when the spreadsheet is edited. * *

		 * var sheet = SpreadsheetApp.getActive();
		 * ScriptApp.newTrigger("myFunction")
		 *   .forSpreadsheet(sheet)
		 *   .onEdit()
		 *   .create();
		 * 
* * @returns a builder for chaining */ onEdit(): ScriptApp.SpreadsheetTriggerBuilder /** * Specifies a trigger that will fire when the spreadsheet has a form submitted to it. * *

		 * var sheet = SpreadsheetApp.getActive();
		 * ScriptApp.newTrigger("myFunction")
		 *   .forSpreadsheet(sheet)
		 *   .onFormSubmit()
		 *   .create();
		 * 
* * @returns A builder for chaining. */ onFormSubmit(): ScriptApp.SpreadsheetTriggerBuilder /** * Specifies a trigger that will fire when the spreadsheet is opened. * *

		 * var sheet = SpreadsheetApp.getActive();
		 * ScriptApp.newTrigger("myFunction")
		 *   .forSpreadsheet(sheet)
		 *   .onOpen()
		 *   .create();
		 * 
* * @returns a builder for chaining */ onOpen(): ScriptApp.SpreadsheetTriggerBuilder } class StateTokenBuilder { private constructor(); /** * Constructs an encrypted string representation of the state token. * *

		 * var stateToken = ScriptApp.newStateToken().createToken();
		 * 
* * @returns an encrypted string representing the token */ createToken(): string /** * Adds an argument to the token. This method can be called multiple times. * *

		 * var stateToken = ScriptApp.newStateToken().withArgument('myField', 'myValue').createToken();
		 * 
* * @param name - the name of the argument * @param value - the value of the argument * * @returns the state token builder, for chaining */ withArgument( name: string, value: string ): ScriptApp.StateTokenBuilder /** * Sets a callback function. The default is a function named callback(). * *

		 * var stateToken = ScriptApp.newStateToken().withMethod('myCallback').createToken();
		 * 
* * @param method - The name of the callback function, represented as a string without parentheses or * arguments. You can use functions from included libraries, such as * Library.libFunction1. * * @returns the state token builder, for chaining */ withMethod( method: string ): ScriptApp.StateTokenBuilder /** * Sets the duration (in seconds) for which the token is valid. The defaults is 60 seconds; the * maximum duration is 3600 seconds (1 hour). * *

		 * var stateToken = ScriptApp.newStateToken().withTimeout(60).createToken();
		 * 
* * @param seconds - the duration for which the token is valid; the maximum value is 3600 * * @returns the state token builder, for chaining */ withTimeout( seconds: number ): ScriptApp.StateTokenBuilder } class Trigger { private constructor(); /** * Returns the event type that the trigger fires on. * *

		 * var triggers = ScriptApp.getProjectTriggers();
		 * for (var i = 0; i < triggers.length; i++) {
		 *   if (triggers[i].getEventType() == ScriptApp.EventType.CLOCK) {
		 *     // Some code here - other options are:
		 *     // ScriptApp.EventType.ON_EDIT
		 *     // ScriptApp.EventType.ON_FORM_SUBMIT
		 *     // ScriptApp.EventType.ON_OPEN
		 *   }
		 * }
		 * 
* * @returns the event type that this is a trigger for */ getEventType(): ScriptApp.EventType /** * Returns the function that will be called when the trigger fires. * *

		 * // Create a trigger for the script.
		 * ScriptApp.newTrigger('myFunction').forSpreadsheet('id of my spreadsheet').onEdit().create();
		 * Logger.log(ScriptApp.getProjectTriggers()[0].getHandlerFunction()); // logs "myFunction"
		 * 
* * @returns the method name */ getHandlerFunction(): string /** * Returns the source of events that will cause the trigger to fire. * *

For example, a spreadsheet onEdit trigger would return SPREADSHEETS, or a time based trigger * would return CLOCK. * *


		 * var triggers = ScriptApp.getProjectTriggers();
		 * for (var i = 0; i < triggers.length; i++) {
		 *   if (triggers[i].getTriggerSource() == ScriptApp.TriggerSource.CLOCK) {
		 *     Logger.log(triggers[i].getUniqueId() + " source is clock");
		 *   } else if (triggers[i].getTriggerSource() == ScriptApp.TriggerSource.SPREADSHEETS) {
		 *     Logger.log(triggers[i].getUniqueId() + " source is spreadsheets");
		 *   }
		 * }
		 * 
* * @returns the publisher this is a trigger for */ getTriggerSource(): ScriptApp.TriggerSource /** * Returns the id specific to the source. * *

For example, if the trigger source is a spreadsheet, this would be the id of the * spreadsheet. For clock events this returns null. * * @returns the id of the entity in the publisher that this is a trigger for */ getTriggerSourceId(): string /** * Returns a unique identifier that can be used to distinguish triggers from each other. * * @returns the unique identifier of the trigger */ getUniqueId(): string } class TriggerBuilder { private constructor(); /** * Creates and returns a DocumentTriggerBuilder tied to the given document. * *


		 * ScriptApp.newTrigger('myFunction')
		 *   .forDocument(DocumentApp.getActiveDocument())
		 *   .onOpen()
		 *   .create();
		 * 
* * @param document - the document * * @returns the new DocumentTriggerBuilder */ forDocument( document: DocumentApp.Document ): ScriptApp.DocumentTriggerBuilder /** * Creates and returns a DocumentTriggerBuilder tied to the document with the given ID. * *

		 * ScriptApp.newTrigger('myFunction')
		 *   .forDocument('1234567890abcdefghijklmnopqrstuvwxyz')
		 *   .onOpen()
		 *   .create();
		 * 
* * @param key - the ID for the document * * @returns the new DocumentTriggerBuilder */ forDocument( key: string ): ScriptApp.DocumentTriggerBuilder /** * Creates and returns a FormTriggerBuilder tied to the given form. * *

		 * ScriptApp.newTrigger('myFunction')
		 *   .forForm(FormApp.getActiveForm())
		 *   .onFormSubmit()
		 *   .create();
		 * 
* * @param form - the form * * @returns the new FormTriggerBuilder */ forForm( form: FormApp.Form ): ScriptApp.FormTriggerBuilder /** * Creates and returns a FormTriggerBuilder tied to the form with the given ID. * *

		 * ScriptApp.newTrigger('myFunction')
		 *   .forForm('1234567890abcdefghijklmnopqrstuvwxyz')
		 *   .onFormSubmit()
		 *   .create();
		 * 
* * @param key - the ID for the form * * @returns the new FormTriggerBuilder */ forForm( key: string ): ScriptApp.FormTriggerBuilder /** * Creates and returns a SpreadsheetTriggerBuilder tied to the given spreadsheet. * *

		 * ScriptApp.newTrigger('myFunction')
		 *   .forSpreadsheet(SpreadsheetApp.getActive())
		 *   .onEdit()
		 *   .create();
		 * 
* * @param sheet - the spreadsheet * * @returns the new SpreadsheetTriggerBuilder */ forSpreadsheet( sheet: SpreadsheetApp.Spreadsheet ): ScriptApp.SpreadsheetTriggerBuilder /** * Creates and returns a SpreadsheetTriggerBuilder tied to the spreadsheet with the given * ID. * *

		 * ScriptApp.newTrigger('myFunction')
		 *   .forSpreadsheet('1234567890abcdefghijklmnopqrstuvwxyz')
		 *   .onEdit()
		 *   .create();
		 * 
* * @param key - the ID for the spreadsheet * * @returns the new SpreadsheetTriggerBuilder */ forSpreadsheet( key: string ): ScriptApp.SpreadsheetTriggerBuilder /** * Returns a builder for building calendar triggers. * * @param emailId - email ID of the user calendar the trigger monitors. * * @returns The new CalendarTriggerBuilder. */ forUserCalendar( emailId: string ): ScriptApp.CalendarTriggerBuilder /** * Creates and returns a ClockTriggerBuilder for building time-based triggers. * *

		 * ScriptApp.newTrigger('myFunction')
		 *   .timeBased()
		 *   .atDate(2013, 10, 31)
		 *   .create();
		 * 
* * @returns the new ClockTriggerBuilder */ timeBased(): ScriptApp.ClockTriggerBuilder } enum TriggerSource { /** * Google Calendar causes the trigger to fire. */ CALENDAR = "CALENDAR", /** * A time-driven event causes the trigger to fire. */ CLOCK = "CLOCK", /** * Google Docs causes the trigger to fire. */ DOCUMENTS = "DOCUMENTS", /** * Google Forms causes the trigger to fire. */ FORMS = "FORMS", /** * Google Sheets causes the trigger to fire. */ SPREADSHEETS = "SPREADSHEETS", } }