Update: if you’re looking for a method using Gmail labels, I’ve added a new article dedicated to this method: Auto archive emails in Gmail after 2 days
Centralising everything in your inbox is a great way to keep track. News, notifications, tasks, updates, daily or weekly digests... Every thread you click on is worth a read. But what about the rest you don’t click?
- The sole email subject is telling you all you need to know?
- You simply don’t have time to read today’s Quora digest?
- You’re not in town this weekend and therefore don’t need to read what Time Out has to suggest?
- You’re not in the mood to catch-up with this week funniest Tweets?
- You just came back from a two-week trip and don’t want to read every LinkedIn notifications you received while you were away?
When your inbox is always a big pile of shit.
It’s inevitable, your inbox is gathering dust due to everything you don’t read. See it as newspapers subscriptions: you’re receiving few daily journals but it’s piling up faster than you can read. Would you commit to read the entire stack from bottom to top when you finally get in the mood?
No. You’d rather take the few latest editions at the top and archive the rest (which is probably already outdated anyway). That’s exactly where you might end up spending a lot of time: cleaning up that pile of shit yourself, when a simple Google Script could do that for you. Yes, MOAR ROBOTS!
All your emails are belong to us.
Who says androids got no heart? This one is gonna make your life easier. Let’s assume you know what emails are going to pile up.
In my case (see below), Spotify’s notifications are pointless to read & archive because everything I need to know is already in the subject line.
Let’s see how we can automatically treat these bastards to avoid them accumulating without even lifting a finger (power of the laziness).
Define a search string
First step is to isolate them with a proper search. Give it a try with the following string (don’t forget to include the double quotes for the first part of the string):
“is now available on Spotify” from:spotify is:unread
The results should only include emails from Spotify with an announcement about new albums available. Remember we’re only looking for unread emails that are piling up, hence the last part of the search string: ‘is:unread’.
Use a Google Script file
Now, we need to action this search through a script that will check every thread (among the results) against a time window we set: is it older than 48h? If yes, then archive. Win.
Copying the Google Script file I made available in a new Google Script file of your own, you will then be able to populate as many search strings as needed in the top part of the code (starting line 9):
Then by pressing Run, you will magically see all the threads being archived according to the criteria you set in your search strings.
Last step is to automatise the process for Google Script to run the script periodically. Twice a day is more than enough unless you’re a weirdo.
Go in the >Resources menu, then click onto >Current project’s triggers, then add a time-driven trigger every 12 hours.
Save that, then you should be all set. You can edit and complete the script with more search strings at any point.
Thanks to this piece of code, not only you will spend less time cleaning your inbox for recurring emails, giving you more time to focus on reading what matters, but you’ll also have an inbox that remains tidy over time, avoiding huge pile of emails pending the painful archiving process.
Looking for a method using labels?
I wrote another post dedicated to the method using Gmail labels instead of using Gmail search: Auto archive emails in Gmail after 2 days
I am keen on knowing if this solution is working for you, or how you adapted it to suit your needs. Questions? Comments? Leave a note here or email me at email@example.com