Builder for spreadsheet triggers.
Methods
Method | Return type | Brief description |
---|---|---|
create() | Trigger | Creates the trigger and returns it. |
onChange() | SpreadsheetTriggerBuilder | Specifies a trigger that will fire when the spreadsheet's content or structure is changed. |
onEdit() | SpreadsheetTriggerBuilder | Specifies a trigger that will fire when the spreadsheet is edited. |
onFormSubmit() | SpreadsheetTriggerBuilder | Specifies a trigger that will fire when the spreadsheet has a form submitted to it. |
onOpen() | SpreadsheetTriggerBuilder | Specifies a trigger that will fire when the spreadsheet is opened. |
Detailed documentation
create()
onChange()
Specifies a trigger that will fire when the spreadsheet's content or structure is changed.
const sheet = SpreadsheetApp.getActive(); ScriptApp.newTrigger('myFunction').forSpreadsheet(sheet).onChange().create();
Return
SpreadsheetTriggerBuilder
— a builder for chaining
onEdit()
Specifies a trigger that will fire when the spreadsheet is edited.
const sheet = SpreadsheetApp.getActive(); ScriptApp.newTrigger('myFunction').forSpreadsheet(sheet).onEdit().create();
Return
SpreadsheetTriggerBuilder
— a builder for chaining
onFormSubmit()
Specifies a trigger that will fire when the spreadsheet has a form submitted to it.
const sheet = SpreadsheetApp.getActive(); ScriptApp.newTrigger('myFunction') .forSpreadsheet(sheet) .onFormSubmit() .create();
Return
SpreadsheetTriggerBuilder
— A builder for chaining.
onOpen()
Specifies a trigger that will fire when the spreadsheet is opened.
const sheet = SpreadsheetApp.getActive(); ScriptApp.newTrigger('myFunction').forSpreadsheet(sheet).onOpen().create();
Return
SpreadsheetTriggerBuilder
— a builder for chaining