Back to Gmail in Excel
SheetXAI logo
Gmail logo
Gmail · Excel Guide

Batch Delete Gmail Messages Matching a Search Query From an Excel Workbook

The Scenario

You are a developer. Your personal Gmail has accumulated 2,000+ automated notification emails from a CI/CD tool, all from the same sender, all older than 6 months. You want them gone.

It is Saturday morning.

The bad version:

  • You open Gmail and run the search
  • Gmail shows 50 at a time
  • You select all on page one, click delete, move to the next page
  • Gmail's "select all conversations in search" button stalls halfway through
  • You are not sure if 1,000 were deleted or 400
  • You check Trash and the math does not add up.

The fast version is one prompt.

The Easy Way: One Prompt in SheetXAI

SheetXAI uses Gmail's batch delete API directly, so "delete all messages matching this search" is an atomic operation, not a page-by-page clicking exercise.

Open the SheetXAI sidebar and type:

Permanently delete all Gmail emails from 'notifications@github.com' that are older than 180 days. Tell me how many were deleted when the operation completes.

SheetXAI runs the search, collects all matching message IDs, calls Gmail's batch delete endpoint, and confirms the count. You did not click through a single page.

What You Get

Every matching email deleted, confirmed with a count:

  • Deleted permanently — not moved to Trash
  • Count confirmed — SheetXAI reports how many were removed
  • Atomic operation — the Gmail API batch delete runs per batch, not per message

If you want to trash instead of permanently delete, say so in the prompt. The behavior is explicit.

What If the Data Is Not Quite Ready

Inbox cleanup operations usually have more nuance than a single sender delete.

When you want to preview the list before deleting

Search Gmail for all emails from 'notifications@github.com' older than 180 days. Write sender, subject, and date into columns A, B, and C of this workbook. Do not delete anything yet — I will review and confirm.

When the delete scope covers multiple senders

Permanently delete all Gmail emails from 'notifications@github.com', 'noreply@jira.com', or 'noreply@sentry.io' older than 90 days. Report the count deleted per sender.

When you want to trash emails with a specific label

Move all Gmail emails with the label "Old-Newsletters" to Trash. Report the count when done.

When you want a log before deleting

Search Gmail for all emails from 'notifications@github.com' older than 180 days. Write sender, subject, and date into columns A through C of this workbook. Then permanently delete all of them and write the final count into cell E1.

The pattern: describe the scope and the action. SheetXAI handles the API calls. Two thousand emails or twenty thousand — the prompt does not change.

Try It

Get the 7-day free trial of SheetXAI and open any workbook, then tell it which Gmail messages to clean up and how. The Gmail integration is included in every SheetXAI plan. For related workflows, see how to audit Gmail filters into an Excel workbook or the Gmail in Excel overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more