A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/guides/triggers/installable below:

Installable Triggers | Apps Script

Installable Triggers

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

Like simple triggers, installable triggers let Apps Script run a function automatically when a certain event, such as opening a document, occurs. Installable triggers, however, offer more flexibility than simple triggers: they can call services that require authorization, they offer several additional types of events including time-driven (clock) triggers, and they can be controlled programmatically. For both simple and installable triggers, Apps Script passes the triggered function an event object that contains information about the context in which the event occurred.

Note: For more information about how to use triggers in add-ons, see Triggers for Google Workspace add-ons. Restrictions

Even though installable triggers offer more flexibility than simple triggers, they are still subject to several restrictions:

Time-driven triggers

A time-driven trigger (also called a clock trigger) is similar to a cron job in Unix. Time-driven triggers let scripts execute at a particular time or on a recurring interval, as frequently as every minute or as infrequently as once per month. (Note that an add-on can use a time-driven trigger once per hour at most.) The time might be slightly randomized—for example, if you create a recurring 9 AM trigger, Apps Script chooses a time between 9 AM and 10 AM, then keeps that timing consistent from day to day so that 24 hours elapse before the trigger fires again.

Event-driven triggers

Installable event-driven triggers are conceptually similar to simple triggers like onOpen(), but they can respond to additional events, and they behave differently.

For example, the installable open trigger for Google Sheets activates whenever the spreadsheet is opened by any user who has edit access, just like the simple onOpen() trigger. However, the installable version can call services that require authorization. The installable version runs with the authorization of the user who created the trigger, even if another user with edit access opens the spreadsheet.

There are several installable triggers for Google Workspace applications:

You can use installable triggers in standalone and bound scripts. For example, a standalone script can programmatically create an installable trigger for an arbitrary Google Sheets file by calling TriggerBuilder.forSpreadsheet(key) and passing in the spreadsheet's ID.

Manage triggers manually

To manually create an installable trigger in the script editor, follow these steps:

  1. Open your Apps Script project.
  2. At the left, click Triggers alarm.
  3. At the bottom right, click Add Trigger.
  4. Select and configure the type of trigger you want to create.
  5. Click Save.
Manage triggers programmatically

You can also create and delete triggers programmatically with the Script service. Start by calling ScriptApp.newTrigger(functionName), which returns a TriggerBuilder.

The following example shows how to create two time-driven triggers—one that fires every 6 hours, and one that fires every Monday at 9 a.m. (in the time zone that your script is set to).

This next example shows how to create an installable open trigger for a spreadsheet. Note that, unlike for a simple onOpen() trigger, the script for the installable trigger does not need to be bound to the spreadsheet. To create this trigger from a standalone script, simply replace SpreadsheetApp.getActive() with a call to SpreadsheetApp.openById(id).

To programmatically modify an existing installable trigger, you must delete it and create a new one. If you have previously stored the ID of a trigger, you can delete it by passing the ID as an argument to the function below.

Before creating a trigger, we recommend that you verify that the associated function has all the necessary OAuth permissions.

Errors in triggers

When an installable trigger fires but the function throws an exception or otherwise fails to run successfully, you don't see an error message on your screen. After all, when a time-driven trigger runs or another user activates your form-submit trigger, you might not even be at your computer.

Instead, Apps Script sends you an email like the following:

From: noreply-apps-scripts-notifications@google.com
Subject: Summary of failures for Google Apps Script
Your script has recently failed to finish successfully.
A summary of the failure(s) is shown below.

The email includes a link to deactivate or reconfigure the trigger. If the script is bound to a Google Sheets, Docs, or Forms file, the email also includes a link to that file. These links let you deactivate the trigger or edit the script to fix the bug.

Note: Installable triggers created by add-ons don't send users these email notices.

To review all of the triggers that are associated with your Google Account and deactivate the triggers you no longer need, follow these steps:

  1. Go to script.google.com.
  2. At the left, click My Triggers.
  3. To delete a trigger, at the right of the trigger, click More more_vert > Delete trigger.

    Note: Simple triggers like onOpen() can't be deactivated from this page; instead, you must edit the appropriate script and remove or rename the onOpen() function.
Triggers in add-ons

In addition to installable triggers, you can use manifest triggers in add-ons. For more information, see Triggers for Google Workspace add-ons.

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 2025-08-04 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-04 UTC."],[[["Installable triggers in Apps Script offer more flexibility than simple triggers, allowing for authorization, time-driven events, and programmatic control, but they have certain restrictions."],["Time-driven triggers, similar to cron jobs, enable scripts to execute at specific times or intervals, even as frequently as every minute."],["Event-driven installable triggers, like simple triggers, respond to events such as opening a document, editing a spreadsheet, or submitting a form, but with the ability to call authorized services."],["Installable triggers can be managed manually through the script editor or programmatically using the Script service, allowing for creation, modification, and deletion."],["When an installable trigger fails, Apps Script sends an email notification to the trigger creator, providing a link to deactivate or reconfigure the trigger."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4