AI-generated Key Takeaways
-
The DocumentTriggerBuilder helps in creating and managing triggers for Google Docs.
-
It provides methods like
create()
to finalize the trigger andonOpen()
to set a trigger for when the document is opened. -
The
onOpen()
method allows you to specify a function to execute when a document is opened, enhancing document automation capabilities.
A builder for document triggers.
Methods
Method | Return type | Brief description |
---|---|---|
create() | Trigger | Creates and returns the new trigger. |
on | Document | Specifies a trigger that will fire when the document is opened. |
Detailed documentation
create()
onOpen()
Specifies a trigger that will fire when the document is opened.
const document = DocumentApp.getActiveDocument(); ScriptApp.newTrigger('myFunction').forDocument(document).onOpen().create();
Return
Document
— This Document
, for chaining.