// generated · Gmail

Archive last week’s promo + newsletter email every Monday.

I want promotions and updates from the past week swept out of my inbox automatically, not deleted.

Every Monday, archive all the promotional and newsletter emails from the past week so my inbox starts clean.

The script

copy · paste · trigger
archivePromosWeekly.gs
Apps Script
// Made with bulldo.gs · describe an automation, get working Apps Script.
// Fork or fix this one → https://bulldo.gs/g/archive-promos-weekly

// Archive promo + update emails from the last week. Run on a Monday trigger
// to start the week with a clean inbox; archived mail stays in All Mail.
function archivePromosWeekly() {
  const query = 'category:promotions OR category:updates newer_than:7d in:inbox';
  const threads = GmailApp.search(query, 0, 200);
  threads.forEach(t => t.moveToArchive());
}

Made with bulldo.gs. Fork it to change a field, a trigger, or the edge cases — describe the change and Gnaw rewrites it.

Walkthrough

How it works

GmailApp.search runs the same query you would type into Gmail’s search bar. `category:promotions OR category:updates` targets the two tabs that fill up fastest; `newer_than:7d in:inbox` scopes it to this week’s unarchived mail.

moveToArchive() removes the Inbox label without deleting anything — the thread stays in All Mail and search. Re-running is harmless: archived threads no longer match `in:inbox`.

The 200-thread cap keeps a single run well under Gmail’s per-execution limits. A normal week rarely exceeds it; raise it only if you also batch.

Schedule it for Monday

In the Apps Script editor open Triggers (the clock icon), add a time-based trigger for archivePromosWeekly(), set it to Week timer → every Monday, early morning. Approve the Gmail scope on the first run; later runs are silent.

Need a different version?

Describe your sheet or inbox and the rule you want. Gnaw writes the Apps Script — fields, triggers, edge cases — in one shot.

FAQ

3 questions
Does this delete the emails?
No. It only removes the Inbox label. Everything stays in All Mail and remains searchable.
How do I keep certain senders in the inbox?
Add an exclusion to the query, e.g. ` -from:status@stripe.com`. Chain as many `-from:` clauses as you need.
Can I archive a wider window than a week?
Change `newer_than:7d` to `newer_than:14d` (or `30d`). For very large windows, lower the trigger cadence so each run stays under the thread cap.