Batch delete thousands of Gmail drafts in seconds
Mail in macOS has long suffered from a bug that can generate thousands of near-duplicate Gmail drafts (the simplest workaround is switching draft storage from server to local).
Selecting more than 50 drafts in the Gmail web interface via "Select all x messages in Drafts" disables the "Discard drafts" option, making large-scale deletion tedious.
A faster alternative is using Google Apps Script. While script executions are limited to 6 minutes, the following API-based method can delete thousands of drafts in seconds (Gmail's API delete methods bypass Trash, so deletions are immediate and irreversible):
Go to https://script.google.com → New project
Paste and save the following script:
In the left-hand menu, click + next to Services
Select Gmail API → Add
Click Run
During testing, used this script to quickly generate 105 drafts:
Updates
Batch delete messages with a specific label and/or within a specific date range
Batch delete uncategorized archived emails
Since archiving in Gmail is just an action (removing the Inbox label), not a location, and the default swipe/discard behavior on iOS, iPadOS, and Android archives rather than deletes, unlabeled archived messages end up silently piling up in All Mail with no easy way to bulk-delete them.
This script permanently deletes all Gmail messages with no system labels (Inbox, Sent, Drafts, Spam, Trash, Chats) and no user labels, effectively purging everything that only exists in All Mail:
To target a specific time range, modify the query variable in the archive cleanup script (see Google's search operators documentation for additional filtering options like larger:, from:, filename:, etc.):
Delete only archived messages older than 2 years:
var query = 'has:nouserlabels -in:inbox -in:sent -in:drafts -in:spam -in:trash -in:chats older_than:2y';Delete archived messages in a specific date range (e.g., 2018–2022):
var query = 'has:nouserlabels -in:inbox -in:sent -in:drafts -in:spam -in:trash -in:chats after:2018/01/01 before:2023/01/01';
❧ 2025-08-06