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]


  • if you copy and paste from this page, do change the apostrophes in (‘label:unread -label:inbox’); otherwise you’re going to have a bad time.

Comments are closed.

Log in to comment on this story!