Appscript

How to skip Google Apps Script Time Based Triggers on Sundays?

Learn to avoid sending unnecessary emails on weekly off days.

We recently created a Google Sheets-based automated report for one of our clients. The report was scheduled to be emailed every evening at 8 PM using a time-based trigger in Google Apps Script.

Everything was running smoothly — until the client came back with a simple but important request:

“Please don’t send the report on Sundays — we’re closed.”

While Google’s time-based triggers are great for automation, they don’t know when to rest. They run like clockwork — even on weekends.

So, we implemented a clean and reliable solution to skip the script on Sundays — and it only took one line of logic.

Let me show you how.

The Sunday Problem

Apps Script time-based triggers are blind to the calendar. They’ll execute as scheduled — whether it’s a working day or not.

So, while the automation was technically perfect, it was functionally a little annoying. It was cluttering inboxes on Sundays when nobody was around to read the email.

How to tackle this issue?

Apps Script supports JavaScript, so we used this logic to detect Sundays:

var today = new Date();
var day = today.getDay(); // Sunday = 0, Monday = 1, ..., Saturday = 6

Now just skip the rest of the script on Sunday:

if (day === 0) return;

Simple, right?

Final Script

Here’s how we structured the final script:

function sendEveningEmailReport() {
var today = new Date();
var day = today.getDay(); // Sunday = 0
if (day === 0) {
Logger.log("Today is Sunday. Skipping email report.");
return;
}
// Actual logic to build and send the report
sendEmailToClient();
}
function sendEmailToClient() {
// Email logic (e.g., using MailApp or GmailApp)
Logger.log("Sending email report to client...");
}

Even though the trigger still runs daily at 8 PM, this logic ensures nothing happens on Sundays.

How to use it?

  • 📊 Client Reports — Send only on working days.
  • 🛒 Sales Dashboards — Skip alerts when the store is closed.
  • 📤 WhatsApp/Email Automation — Avoid unnecessary pings.
  • 🧘‍♂️ Work-Life Boundaries — Respect your team’s off days.

Skip Multiple Days

If your client is closed on weekends:

if (day === 0 || day === 6) return;

Or to run only on weekdays:

if (day >= 1 && day <= 5) {
// proceed
}

Conclusion

Just because a script can run daily doesn’t mean it should. Adding this tiny calendar check made our client happier and their inbox cleaner.