apps-script-utils 2.1.1 Help

getTriggerById

function getTriggerById(id: string): GoogleAppsScript.Script.Trigger | null;

Apps Script hands out a trigger id when a trigger is created but offers no way to look one up again, so the project's triggers are walked and compared. A trigger that has since been deleted gives null, which is the case a stored id has to handle.

Parameters

Parameter

Type

Description

id

string

The trigger id. It must not be empty.

Returns

GoogleAppsScript.Script.Trigger | null — the trigger, or null when the project has none with that id.

Throws

Exception

Condition

EmptyStringException

the id is not a string, or is empty.

Examples

Looking up

const id = PropertiesService.getScriptProperties().getProperty("TRIGGER_ID"); const trigger = getTriggerById(id); if (trigger !== null) { ScriptApp.deleteTrigger(trigger); }

See also

Source

src/appsscript/base/getTriggerById.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.