The Gmail Inbox Reset

Automatically archive Gmail older than 30 days and keep starred emails in your inbox.

Download the Free Gmail Inbox Reset Guide (PDF)

How 70,000 emails led me to build a 30-day Gmail inbox

I started by cleaning up my Downloads folder. Once that looked better, I moved on to my desktop. Then I opened Gmail.

I had about 70,000 emails. I wanted my inbox to feel usable again, so I started with the obvious stuff: promotions, marketing emails, and notifications I had no reason to keep looking at. I liked the idea of archiving them because I could still find them later. And honestly, part of me still wanted to be able to look up a good deal if I remembered seeing one.

After several rounds of cleanup, I still had more than 2,000 unread emails. Going sender by sender was taking forever. And every day, more mail came in.

The email that finally made me rethink the whole thing was a Google sign-in alert. That’s something I want to see when it happens. But does it need to sit in my inbox a month later? The same went for old verification codes, delivery updates, and plenty of other messages that were useful for about five minutes.

I’d used Gmail filters before. They worked well for dealing with new mail from a specific sender, but I wanted one rule that would apply as messages aged. What if my inbox just showed the last 30 days, plus anything I’d starred to keep around?

Why I used Google Apps Script

I could search Gmail for older messages and archive them in bulk. That would take care of the backlog in one sitting. I wanted the same cleanup to happen tomorrow, next week, and six months from now without having to remember to do it myself.

So I set up a small Google Apps Script. On a daily schedule, it looks for messages in my inbox that are older than 30 days and aren’t starred. It archives those messages and adds a label so I can see what the script moved. The script and its schedule live in my Google account. Once I set them up, the daily cleanup runs without ChatGPT or an AI subscription.

My first version also kept anything marked Important. That sounded reasonable until I looked at what was still hanging around. Gmail had decided some old Xfinity and VASA Fitness emails were important based on past activity. I understood why Gmail had flagged them, but I wouldn’t have chosen to keep them in my inbox.

So I dropped that exception. Now I use the star for one simple thing: keep this in my inbox past 30 days.

What happens to the archived emails?

They’re still in Gmail. If I need an old receipt or remember something a person sent me, I search by sender, subject, or keyword like I always have. If I want to browse only archived mail, I type in:archive into Gmail’s search bar. I can also open the Archived Inbox Backlog label to see the messages the script moved.

That’s what made the whole thing click for me. I could get years of email out of my daily view while keeping it available when I needed it. And when an email comes in that I know I’ll need next month, I just star it.

The free one-page guide includes the exact script to copy and paste, plus step-by-step instructions for setting it up, running it the first time, and scheduling the daily cleanup. I wrote it for someone who’s never opened Google Apps Script before.