Creates a new trigger that runs a function on a schedule or event.
class ScriptApp method .newTrigger()
ScriptApp is the Apps Script service.
.newTrigger() is the method name you will see after a dot in your code.
What it does
Why it's used
- Run nightly cleanup or hourly sync on a schedule.
- Wire onFormSubmit or onEdit without the Triggers UI.
Common errors
- Forgetting parentheses on newTrigger. Write ScriptApp.newTrigger(), not ScriptApp.newTrigger or newTrigger by itself.
- Skipping dots between chained calls. Each step needs a dot, like ScriptApp.newTrigger().
- Adding spaces where they do not belong. Write ScriptApp.newTrigger(), not ScriptApp .newTrigger(), ScriptApp.newTrigger (), or ScriptApp . newTrigger().
- Wrong capitalization. Use ScriptApp and newTrigger, not scriptapp or newtrigger.
Snippets using this method
Explore
Related methods
-
.deleteTrigger()
Removes an existing trigger.
-
.getProjectTriggers()
Returns all triggers set up in the script project.
-
.getService()
Returns a connected advanced Google service, like BigQuery or YouTube.
-
.invalidateAuth()
Clears stored authorization so the user must approve access again.
-
.getScriptId()
Returns the unique ID of the current script project.
More Apps Script
Better Sheets tutorials
Automate Emails
Built a Cookie Clicker Clone in Google Sheets
Create an Automated Task List
I Created an Automatic Emailer
Self Destructing Google Sheet
Visicalc 2023 Design Walkthrough
Related blog posts
Written guides about ScriptApp.newTrigger().
How to Send Google Forms Entries Automatically with Apps Script
Google Forms provides basic email notifications for form submissions, but enhancing these notifications with detailed summaries can significantly improve productivity and response management.
Read post →What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users
Make your data tasks simpler & efficient. Discover the power of automation in Google Sheets with a comprehensive guide that covers everything from triggers to scripts.
Read post →How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →