GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • Apps Script
  • All products
  • Admin console
  • Cloud Search
  • Gmail
  • Google Calendar
  • Google Chat
  • Google Classroom
  • Google Docs
  • Google Drive
  • Google Forms
  • Google Keep
  • Google Meet

This view

  • Original page
  • New address

GeezerVison is showing developers.google.com — Class DocumentTriggerBuilder | Apps Script | Google for Developers

Class DocumentTriggerBuilder Stay organized with collections Save and categorize content based on your preferences.

Spark icon

Page Summary

  • DocumentTriggerBuilder is used to build document triggers.

  • The create() method creates and returns the new trigger.

  • The onOpen() method specifies a trigger that fires when a document is opened.

DocumentTriggerBuilder

A builder for document triggers.

Methods

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

Detailed documentation

create()

Creates and returns the new trigger.

Return

Trigger — The new trigger.


onOpen()

Specifies a trigger that fires when the document is opened.

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

Return

DocumentTriggerBuilder — This DocumentTriggerBuilder, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-04-13 UTC.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.