Automatically Mark All Archived Email As Read With A Gmail Script

Automatically Mark All Archived Email As Read With A Gmail Script

Some messages are so short, you don’t even need to open them — you can just archive them from your inbox, or from Android’s notification drawer. Of course, then you have a bunch of archived, unread emails. This simple Gmail script will fix that.

This Google script will run in the background, on Google’s servers, and mark any archived email as read without you having to lift a finger. To create the script, head to and create a new Blank Project. Delete the code that’s there and replace it with the following code:

function markArchivedAsRead() {

var threads =‘label:unread -label:inbox’);



Then, do the following:

  1. Save the project with File > Save.
  2. Mark an archived email as unread in your Gmail account. Then, click the Run button in the Google Script window to test it. If your email gets marked as read, it works!
  3. Head to Resource > Current Project’s Triggers and set how often you want the script to run. (I have mine set to run every 12 hours, but you can set it more often if you like.)
  4. Save the script again and exit. It will continue running in the background from here on out.

It’s a silly little annoyance, but now Android’s “Archive” button in the notification drawer acts a bit more like “Archive and Mark Read”, and you’ll never have unread messages floating around your archive.

Marking Gmail read with Apps Script [Mike Crittenden]

The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.


One response to “Automatically Mark All Archived Email As Read With A Gmail Script”