Script Service

This service provides access to script triggers and script publishing.


NameBrief description
AuthModeAn enumeration that identifies which categories of authorized services Apps Script is able to execute through a triggered function.
ClockTriggerBuilderA builder for clock triggers
EventTypeAn enum denoting the type of the event.
FormTriggerBuilderA builder for form triggers.
ScriptAppAccess and manipulate script publishing and triggers.
ServiceAccess and manipulate script publishing.
SpreadsheetTriggerBuilderBuilder for spreadsheet triggers.
StateTokenBuilderAllows scripts to create state tokens that can be used in callback APIs (like OAuth flows).
TriggerA script trigger
TriggerBuilderA generic builder for script triggers.
TriggerSourceEnum denoting what the source of the event that the trigger fires on is.

Class AuthMode


NONEEnumA mode that does not allow access to any services that require authorization.
CUSTOM_FUNCTIONEnumA mode that allows access to a limited subset of services for use in custom spreadsheet functions.
LIMITEDEnumA mode that allows access to a limited subset of services.
FULLEnumA mode that allows access to all services that require authorization.

Class ClockTriggerBuilder


MethodReturn typeBrief description
after(durationMilliseconds)ClockTriggerBuilderSpecifies the duration (in milliseconds) after the current time that the trigger will run.
at(date)ClockTriggerBuilderSpecifies when the trigger will run (plus or minus 15 minutes).
atDate(year, month, day)ClockTriggerBuilderSpecifies trigger will fire on the given date, by default near midnight (+/- 15 minutes).
atHour(hour)ClockTriggerBuilderSpecifies the hour the trigger will run (plus or minus 15 minutes).
create()TriggerCreates the trigger.
everyDays(n)ClockTriggerBuilderSpecifies to run the trigger every n days.
everyHours(n)ClockTriggerBuilderSpecifies to run the trigger every n hours.
everyMinutes(n)ClockTriggerBuilderSpecifies to run the trigger every n minutes.
everyWeeks(n)ClockTriggerBuilderSpecifies to run the trigger every n weeks.
inTimezone(timezone)ClockTriggerBuilderSpecifies the timezone that the specified dates/time that the trigger will run in.
nearMinute(minute)ClockTriggerBuilderSpecifies the minute the trigger will run (plus or minus 15 minutes).
onMonthDay(day)ClockTriggerBuilderSpecifies on what date in the month that the trigger will run.
onWeekDay(day)ClockTriggerBuilderSpecifies on what day of the week that the trigger will run.

Class EventType



Class FormTriggerBuilder


MethodReturn typeBrief description
create()TriggerCreates and returns the new trigger.
onFormSubmit()FormTriggerBuilderSpecifies a trigger that will fire when a response is submitted to the form.
onOpen()FormTriggerBuilderSpecifies a trigger that will fire when the form's edit view is opened.

Class ScriptApp




MethodReturn typeBrief description
deleteTrigger(trigger)voidRemoves the given trigger so it will no longer run.
getOAuthToken()StringGets the OAuth 2.0 access token for the current user.
getProjectTriggers()Trigger[]Returns an array of triggers associated with the current project.
getService()ServiceReturns a Service object to manage publishing the script as a web app.
invalidateAuth()voidInvalidates the authorization this user has to execute the current script.
newStateToken()StateTokenBuilderCreates a builder for a state token that can be used in a callback API (like an OAuth flow).
newTrigger(functionName)TriggerBuilderBegins the process of creating a trigger that when fired, will call the passed in method.

Class Service


RestrictionService.RestrictionEnum representing the access restrictions on a script exported as a service.


MethodReturn typeBrief description
disable()voidDisables the script from being accessed as a web app.
enable(restriction)voidAllows the script to be accessed as a web app with the specified permissions.
getUrl()StringReturns the URL of the web app, if it has been deployed; otherwise returns null.
isEnabled()BooleanReturns true if the script is accessible as a web app.

Class Service.Restriction



Class SpreadsheetTriggerBuilder


MethodReturn typeBrief description
create()TriggerCreates the trigger and returns it.
onChange()SpreadsheetTriggerBuilderSpecifies a trigger that will fire when the spreadsheet's content or structure is changed.
onEdit()SpreadsheetTriggerBuilderSpecifies a trigger that will fire when the spreadsheet is edited.
onFormSubmit()SpreadsheetTriggerBuilderSpecifies a trigger that will fire when the spreadsheet has a form submitted to it.
onOpen()SpreadsheetTriggerBuilderSpecifies a trigger that will fire when the spreadsheet is opened.

Class StateTokenBuilder


MethodReturn typeBrief description
createToken()StringConstructs an encrypted string representation of the state token.
withArgument(name, value)StateTokenBuilderAdds an argument to the token.
withMethod(method)StateTokenBuilderSets a callback function.
withTimeout(seconds)StateTokenBuilderSets the duration (in seconds) for which the token is valid.

Class Trigger


MethodReturn typeBrief description
getEventType()EventTypeReturns the event type that the trigger fires on.
getHandlerFunction()StringReturns the function that will be called when the trigger fires.
getTriggerSource()TriggerSourceReturns the source of events that will cause the trigger to fire.
getTriggerSourceId()StringReturns the id specific to the source.
getUniqueId()StringReturns a unique identifier that can be used to distinguish triggers from each other.

Class TriggerBuilder


MethodReturn typeBrief description
forForm(form)FormTriggerBuilderCreates and returns a FormTriggerBuilder tied to the given form.
forForm(key)FormTriggerBuilderCreates and returns a FormTriggerBuilder tied to the form with the given ID.
forSpreadsheet(sheet)SpreadsheetTriggerBuilderCreates and returns a SpreadsheetTriggerBuilder tied to the given spreadsheet.
forSpreadsheet(key)SpreadsheetTriggerBuilderCreates and returns a SpreadsheetTriggerBuilder tied to the spreadsheet with the given ID.
timeBased()ClockTriggerBuilderCreates and returns a ClockTriggerBuilder for building time-based triggers.

Class TriggerSource



Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.