# Neil Gandhi - Automatically Mark Archived Emails as Read (Highlights)

## Metadata
**Review**:: [readwise.io](https://readwise.io/bookreview/56918087)
**Source**:: #from/readwise #from/reader
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Neil Gandhi]]
**Full Title**:: Automatically Mark Archived Emails as Read
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**URL**:: [www.realdealneil.com](https://www.realdealneil.com/posts/2025/01/archive-and-mark-as-read-gmail/)
**Host**:: [[www.realdealneil.com]]
**Highlighted**:: [[2025-12-17]]
**Created**:: [[2025-12-20]]
## Highlights
- Go to [script.google.com](https://script.google.com) and click on **New Project**. ([View Highlight](https://read.readwise.io/read/01kcpdzwxwbxv1rtekvaaacvte)) ^967443286
- Paste the following code block into the code editor and click the save button. ([View Highlight](https://read.readwise.io/read/01kcpe04p8rmkz3tny4jf2ft35)) ^967443295
There's a limitation that the API can only mark 100 emails as read.
```
function markArchivedAsRead() {
var threads = GmailApp.search('label:unread -label:inbox');
GmailApp.markThreadsRead(threads.slice(0, 100));
};
```
- Navigate to the **Triggers** page from the left nav menu and click **Add Trigger**. ([View Highlight](https://read.readwise.io/read/01kcpekc0n5h47qq6gvegdsbs0)) ^967444720