Set up a weekly Gmail clean-up script that protects receipts with Gemini
- Posted
- by Andrew Ledet (Ask Andrew, Substack)
- Last checked
- Method:
- How we verify
Evidence: Described by posterThe person describes what happened in words, without screenshots or video.
Context: The prompt the writer shares is a version for readers; Gemini's exact replies aren't shown.
Outcome
Andrew Ledet was tired of repeating a two-hour manual inbox clean-up. Working with Gemini, they built a Google Apps Script 'Janitor' that audits top senders, does a dry run, then clears old promotions, social and update emails while skipping anything from themselves, starred, or that looks like a receipt or order. The first run deleted more than 5,000 emails in a few minutes, and it now runs automatically every Monday at 3 a.m.
Agent
Prompt Recreated prompt
The source didn't share its exact prompt, so we wrote this from what it describes.
Before you start, ask me 1–3 short questions about anything important that's missing below. Keep them quick. Then do the task, checking in with me at the key points. Goal: Help me build a weekly automatic Gmail clean-up that removes old clutter but never touches receipts, starred mail or things I sent. What I can give you (ask for whatever's missing): - Which Gmail categories I want cleaned (Promotions, Social, Updates) - How old emails should be before they go - Senders I always want cleared and anything I always want kept Rules: - Start with a script that only reports my top 20 senders by thread count. - Then write a dry run that lists what would be deleted and the estimated space saved, and wait for my OK. - Exclude anything from me, starred, marked important, or that looks like a receipt or order. - Only then give me the final script and step-by-step instructions for a weekly time-based trigger. - Check facts that can change (prices, opening hours, dates, availability, rules) against the official source, and tell me anything you couldn't verify. Output: Three short scripts (audit, dry run, weekly clean-up) with plain-English setup steps. You'll know it worked when: the clean-up runs on its own each week and nothing I need goes missing.
Try this in:
Sends the Recreated prompt shown above. ChatGPT and Grok open with it filled in, and ChatGPT may send it straight away. Gemini opens empty, so we copy the prompt for you to paste. Every button also copies it.
Opens in a new tab. We don't see what you send.
These links are only a shortcut. We're not affiliated with OpenAI, Google or xAI, and your results may not match the source.
Optional stronger version
Our rewrite with extra checks. The poster didn't test it.
Before you start, ask me 1–3 short questions about anything important that's missing below. Keep them quick. Then do the task, checking in with me at the key points. Goal: Help me build a weekly automatic Gmail clean-up that removes old clutter but never touches receipts, starred mail or things I sent. What I can give you (ask for whatever's missing): - Which Gmail categories I want cleaned (Promotions, Social, Updates) - How old emails should be before they go - Senders I always want cleared and anything I always want kept Rules: - Start with a script that only reports my top 20 senders by thread count. - Then write a dry run that lists what would be deleted and the estimated space saved, and wait for my OK. - Exclude anything from me, starred, marked important, or that looks like a receipt or order. - Only then give me the final script and step-by-step instructions for a weekly time-based trigger. - Check facts that can change (prices, opening hours, dates, availability, rules) against the official source, and tell me anything you couldn't verify. - Explain how to switch the trigger off and where deleted emails go, in case I need to recover one. Output: Three short scripts (audit, dry run, weekly clean-up) with plain-English setup steps. You'll know it worked when: the clean-up runs on its own each week and nothing I need goes missing. Before you finish: re-read my goal and constraints, check your answer against each one, and list anything you assumed or couldn't confirm.
Source
https://askandrew.substack.com/p/taming-the-unruly-inbox
Related cases
- Cut 23,000 unread emails to about 8,000 with one Gemini command in GmailEvidence: Described by posterBeginner-friendly
Faced with more than 23,000 unread emails, David Alonge asked Gemini in Gmail to 'Delete all unread emails from 2009 to 2022.' Within a few minutes the unread count dropped to about 8,000, a job Alonge expected would have taken weeks by hand.
Gemini · Personal · Source date:
- Clear over 9,400 unread emails safely by building a 'safe list' first with ChatGPTEvidence: Described by poster
Back from a week away, Abha Malpani Naismith had more than 9,400 unread Gmail messages. Claude couldn't act inside the connected inbox for them, so they switched to ChatGPT with Gmail connected. It analysed the inbox by sender, subject and category without opening emails, built a 'Safe List' of financial, legal, medical, school and travel mail never to touch without approval, and then helped archive, label, delete or unsubscribe in bulk. They archived or deleted more than 4,500 emails and reached inbox zero in about 30 minutes.
ChatGPT · Personal · Source date:
- Delete 47,000 old promotional emails by finding the top senders first with ClaudeEvidence: Described by poster
With Claude connected to their Gmail, J. McLaughlin asked for a snapshot of the mailbox, then for the highest-volume promotional senders: years of store deals, grocery ads and app notifications. Claude pulled unsubscribe links and wrote Gmail search queries for each round of bulk deletion, which McLaughlin ran and confirmed in Gmail themselves. In one sitting they deleted more than 47,000 emails, over half the mailbox, and got the inbox down to five things that mattered.
Claude · Personal · Source date: