generate_trigger_code
Generates Apps Script code to create automated triggers for Google Workspace, enabling scheduled or event-driven automation when direct API creation isn't possible.
Instructions
Generates Apps Script code for creating triggers.
The Apps Script API cannot create triggers directly - they must be created from within Apps Script itself. This tool generates the code you need.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trigger_type | Yes | Type of trigger. One of: - "time_minutes" (run every N minutes: 1, 5, 10, 15, 30) - "time_hours" (run every N hours: 1, 2, 4, 6, 8, 12) - "time_daily" (run daily at a specific hour: 0-23) - "time_weekly" (run weekly on a specific day) - "on_open" (simple trigger - runs when document opens) - "on_edit" (simple trigger - runs when user edits) - "on_form_submit" (runs when form is submitted) - "on_change" (runs when content changes) | |
| function_name | Yes | The function to run when trigger fires (e.g., "sendDailyReport") | |
| schedule | No | Schedule details (depends on trigger_type): - For time_minutes: "1", "5", "10", "15", or "30" - For time_hours: "1", "2", "4", "6", "8", or "12" - For time_daily: hour as "0"-"23" (e.g., "9" for 9am) - For time_weekly: "MONDAY", "TUESDAY", etc. - For simple triggers (on_open, on_edit): not needed |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |