Bulk delete Gmail emails to clean up your inbox
How to bulk delete Gmail emails to clean up your inbox: install the Chrome extension, click Build with Browser agent, tell the agent what you want, and follow its prompts. A working bot is built and tested in minutes.
Here is how the automation works. To bulk delete Gmail emails, list the senders or search terms with Enter custom data, then loop through them: each term is typed into Search in mail, every result is selected, and the matching emails are deleted. Where Gmail offers Select all conversations that match this search, the automation clicks it, so every match goes, not only the first page.
Build the Gmail inbox cleaner from a description
Describe it and click the button: the agent builds and tests the inbox cleaner in your Chrome extension. Gmail has to be open and logged in in Chrome; for a cloud run, add the login steps from automate Gmail login with 2FA.
- Take my list of senders and search terms
- Search my Gmail inbox for each one
- Select every email that matches
- Delete them all
Have the sender addresses or search terms ready, one per line. Test first with a term whose emails you do not need: every conversation that matches is deleted, not only the first page.
The video shows the agent building the Gmail inbox cleaner from the lines above, in a few minutes.
Build the Gmail inbox cleaner step by step
The steps the agent builds, as the Builder shows them: each step by its name, with the fields to set under it. Add them yourself in this order in the step-by-step builder, or open the agent's result there to adjust it.
- 1.0
Enter custom dataCustom data: the senders and search terms, one per line
- 2.0
Go to pageURL:https://mail.google.com/mail/u/0/#inbox
- 3.0
Loop through data- repeats for every row in
[custom-data]
- 3.1
Enter textSelect text field: the Search in mail boxText: the current row of[custom-data]
- 3.2
Press key(s)Key: Enter
- 3.3
Click elementSelect: the Select All tick box above the email list
- 3.4
Get data from bot's current pageSelect: the Select all conversations that match this search link
- 3.5
If conditionData to check:[scrape-data]
- 3.5.1
Click elementSelect: the Select all conversations that match this search link
- 3.6
Click elementSelect: the Delete button
- 3.7
WaitWait time: 3000
- repeats for every row in
Common questions about bulk deleting Gmail emails
Why does the Gmail cleaner loop only once?
A blank line or a trailing space in Custom data on Enter custom data stops the list early. Remove them so each line holds one term.
Why does the automation open the wrong Gmail page?
Check that Go to page has https://mail.google.com/mail/u/0/#inbox in Enter URL.
Why is the Gmail search not working?
In Enter text, reselect the Search in mail box. When a run fails, hand it to the agent and it repairs the step.
Why is Select All not clicked in Gmail?
Reselect the Select All tick box in the first Click element step.
Why is the "Select all conversations" link not clicked?
Reselect Select all conversations that match this search in Get data from bot's current page, and check that If condition checks [scrape-data]. If the scraper retries too long when the link is missing, open Configure scraper and set No. of retries to 1.
Why is the Delete button not clicked in Gmail?
Reselect the Delete button in its Click element step.
Why does the Gmail cleaner behave randomly?
Gmail is usually still loading. Increase the time in the Wait step.
Can I bulk delete Gmail emails without code?
Yes. The cleaner is a list of search terms and a handful of clicks on Gmail's own buttons, built by the agent from the lines above; nothing in it is code.
Can I delete Gmail emails older than a date, or from a whole category?
Yes. A line on the list can be any Gmail search, so older_than:1y matches everything older than a year and category:promotions older_than:30d the older promotions, and the cleaner deletes every match the same way.
Can I use the Gmail cleaner to send emails instead?
Yes, with a different automation. See create an email blast or the Gmail mail merge guide.
Where do I get help?
Get in touch with support, or ask in the axiom.ai community.
Related guides
Send Instagram DMs from a Google Sheet
- Read the profile links and messages from my sheet
- Skip any rows already marked Sent
- Open each profile link
- Check the profile header for the word Message
- If it is there, click Message and send the message
- Write Sent back into the row, in column C
Mail merge in Gmail from a Google Sheet
- Read the rows from my Mail merge sheet
- Open a new email in Gmail for each row
- Fill in the address, subject and body
- Send it and delete the row
Extract email addresses from a website into a Google Sheet
- Go to the page I give you
- Find every email address on it
- Add them to my Google Sheet, no duplicates