Automating the Inbox Scheduling Automated Tasks in Gmail

I am not an Inbox Zero person. I probably never will be. But while I may never achieve the coveted Zero, I don't like a lot of clutter in my inbox either.


I created a Google Spreadsheet that runs scheduled searches in my Gmail account and takes actions on the results.

Use at your own risk.

Link to the spreadsheet:

The Problem

Filters in Gmail are great, and they take care of a lot of automation for me. But that's only half of the battle. Filters run when a new email comes in, but most of the time I see the email and need to do something with it later, but will absentmindedly forget to.

I wanted to schedule automated tasks for my Gmail account that took care of things without me having to think about it. Some personal use cases:

  • Mark anything I've starred as unread so that it reminds me to look at it again
  • Archive my Seamless confirmations
  • Trash any read daily subscriptions
  • Trash any shipping notifications that more than a week old

The Solution

I whipped up a Google Script, attached it to a Google Spreadsheet, and a magically cleaner inbox followed.

Please Note

I am making this Google Spreadsheet public for others to use because it's been very helpful for me. I've done a lot of work to make it as user friendly and error free as possible, but it comes as is.

I can't be held accountable if you decide to use it and it messes up something in your Gmail account.

You can, if you'd like to, take a peek behind the scenes at what is running by clicking on Tools > Script Editor and viewing the code itself.

That being said, I do feel pretty confident that it will make your life better. If you'd like to use it, full instructions are below.

Automating Your Inbox

The spreadsheet can be found here:

Copy to Your Google Drive

The link above is a View Only spreadsheet, so in the upper left hand corner click File > Make a Copy and copy it into the Google Drive account associated with the Gmail account you'd like to automate.

Copy to your Google Drive


Once it's in your Google Drive, you have to authorize it to manage your Gmail. Click Inbox Cleanup > Initialize.


A pop-up will appear asking you to authorize the spreadsheet script.

Authorize pop up

A second pop-up will let you know which permissions the app needs.

App permissions

Creating Actions

Now it's time to schedule some actions to run on your inbox. To use this really effectively, I suggest you use Gmail Advanced Search to drill down to exactly the messages you want to affect.

It is always recommended to create the search in Gmail itself to make sure you are getting the correct results, then copy the search into the spreadsheet.


A quick note on scheduling. The options are:

  • Monthly: runs between midnight and 1am local time on the first of the month
  • Weekly: runs between midnight and 1am local time on Sunday each week
  • Daily: runs between midnight and 1am local time each night
  • Per Hour: runs once an hour
  • Per Minute: runs once a minute


Marking Starred Items as Unread

I have a habit of starring something in order to remember it, but not paying attention to afterwards. Marking the message as unread forces me to look at it again and take care of it.

Very simple: Every day, look for my starred messages (is:starred) and mark them as unread again.

Marking starred as unread

Archiving Receipts

If something has been marked as a receipt, chances are I probably need it, but don't need it in my inbox.

A little more complex but still easy peasy: emails in my inbox (label:inbox) that I have read (is:read) and are not starred (-is:starred) and have the Receipt label (label:receipt) are good to archive.

Archive Receipts

Trash Old Shipping Notifications

I compulsively check my package tracking, but once the item has gotten to me that shipping notification email will probably sit in my inbox forever. Until now.

Emails in my inbox (label:inbox) that I have read (is:read) and are not starred (-is:starred) and have the Shipping label (label:shipping) and are older than seven days (older_than:7d), get rid of 'em.

Trash old shipping notifications

And There's More

These are just a couple of simple examples. Currently the options you can take are:

  • archiving
  • trashing
  • marking as read/unread
  • marking as important/unimportant
  • adding/removing a star
  • forwarding
  • adding/removing a label

What Else?

What else can we do with this? Any suggestions for additional automation based on this idea? Let me know in the comments.

Title background image by Ryan McGuire (Gratisography)