Skip to content

Task guide

Run an Apps Script function every day

Run the setup function once, then Apps Script calls the reminder function each day around your chosen hour.

1 · Prepare

Put these pieces in place

  • Use an account that can send email through Gmail.
  • Decide whether a daily reminder email is useful before installing the trigger.
  • Keep both functions in the same Apps Script project.

Change these values

Change these values

Make the code yours before you run it.
Run hour
9

The trigger runs around this hour in the script project time zone.

Email subject
Daily script reminder

This is the subject delivered to the script owner.

Handler name
sendDailyReminder

The setup function checks this name before making another trigger.

2 · Review before running

What the script can access and change

Permissions you approve

  • Create and view triggers in this Apps Script project.
  • Send a daily email from your Google account.

Effects of one run

  • Creates one daily time trigger when one is not already installed.
  • Sends the script owner one reminder email each day around 9 AM in the project time zone.

3 · Copy

Paste this into the Apps Script editor

Create or open a script file, replace the example values marked above, then save the project.

Code.gs
const RUN_HOUR = 9; // The trigger runs around this hour in the script project time zone.
const EMAIL_SUBJECT = 'Daily script reminder'; // This is the subject delivered to the script owner.
const HANDLER_NAME = 'sendDailyReminder'; // The setup function checks this name before making another trigger.

function createDailyReminder() {
  const alreadyInstalled = ScriptApp.getProjectTriggers().some((trigger) => {
    return trigger.getHandlerFunction() === HANDLER_NAME;
  });
  if (alreadyInstalled) return;

  ScriptApp.newTrigger(HANDLER_NAME)
    .timeBased()
    .everyDays(1)
    .atHour(RUN_HOUR)
    .create();
}

function sendDailyReminder() {
  const recipient = Session.getEffectiveUser().getEmail();
  GmailApp.sendEmail(recipient, EMAIL_SUBJECT, 'Your daily Apps Script reminder ran successfully.');
}

4 · Run safely

Follow these steps in order

  1. Paste both functions

    The first function installs the schedule. The second function is the work that runs each day.

  2. Run the setup function once

    Choose createDailyReminder and run it. Approve the requested access when Google asks.

  3. Check the trigger list

    In Apps Script, open Triggers from the left sidebar to see the daily schedule.

5 · Confirm

How to tell it worked

The trigger list shows sendDailyReminder as a daily trigger, and the script owner receives the reminder after it runs.

If the result is different

Troubleshooting

The setup function seems to do nothing.
It intentionally stops when a trigger for sendDailyReminder already exists. Check the Triggers list instead of running it repeatedly.
The email arrives at an unexpected time.
Check the Apps Script project time zone, then change RUN_HOUR to the hour you want and reinstall the trigger.

Technical details

Names used in this script

Open these details when you want to adapt the example or look up an exact service or method name.

Show Apps Script symbols and service pages

Keep going