Class DocumentTriggerBuilder

DocumentTriggerBuilder

A builder for document triggers.

Methods

MethodReturn typeBrief description
create()TriggerCreates and returns the new trigger.
onOpen()DocumentTriggerBuilderSpecifies a trigger that will fire when the document is opened.

Detailed documentation

create()

Creates and returns the new trigger.

Return

Trigger — The new trigger.


onOpen()

Specifies a trigger that will fire when the document is opened.

const document = DocumentApp.getActiveDocument();
ScriptApp.newTrigger('myFunction').forDocument(document).onOpen().create();

Return

DocumentTriggerBuilder — This DocumentTriggerBuilder, for chaining.