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

Creates a new trigger that runs a function on a schedule or event.

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.

Explore

Related methods

Better Sheets tutorials

Automate Emails

Automate Emails

Set up automated email notifications based on Google Sheets data. Super ...
Automatic Calculations

Automatic Calculations

Create custom scripts to make your spreadsheets more like tools.
Built a Cookie Clicker Clone in Google Sheets

Built a Cookie Clicker Clone in Google Sheets

I built a clone of Cookie Clicker, live on YouTube. Watch the full 1 hou...
Create an Automated Task List

Create an Automated Task List

I've created simple automations to make an awesome automatic task list. ...
Different Kinds of Automation

Different Kinds of Automation

A brief description of types of automation. I go way more in depth in “M...
How to Power Testimonials with Google Forms and Sheets

How to Power Testimonials with Google Forms and Sheets

I show you how I use a Google Form and a Google Sheet to power the testi...
I Created an Automatic Emailer

I Created an Automatic Emailer

While creating SheetOps, a new product, I came up with this idea of an a...
Self Destructing Google Sheet

Self Destructing Google Sheet

Create a sheet that can trash itself. It can delete itself instantly or ...
Visicalc 2023 Design Walkthrough

Visicalc 2023 Design Walkthrough

Design walkthrough of VisiCalc 2023. Watch this if you'd like to see the...
Visicalc 2023 Quick Walkthrough

Visicalc 2023 Quick Walkthrough

This is a fun template I created for April 1st. Take a quick walk throug...

Related blog posts

Written guides about ScriptApp.newTrigger().

Browse the blog