From Inbox to Insights: How We Turned Our Entire Gmail History into a Lead List in Google Sheets
TL;DR: We wrote a Google Apps Script that crawls our entire Gmail history, extracts every contactable email address (From/To/Cc/Bcc), dedupes + validates, tags with context, and writes it all into a Google Sheet for lead gen. It runs in batches with resume checkpoints, supports filters (include/exclude domains/labels), and drops a clean, CRM-ready table.
Why we built it
Over the years, our team has emailed thousands of people—prospects, partners, event signups, trial users, you name it. That history is gold… but it’s buried across threads, labels, and accounts. We wanted a one-time harvest and an ongoing trickle that turns inbox activity into a structured lead source—without buying yet another tool.
What the script does
Scans Gmail (your mailbox) using label queries (e.g., in:anywhere -category:promotions), in paged batches to respect quotas.
Extracts emails from From/To/Cc/Bcc headers (per message, not just top thread).
Optionally scrapes email-looking strings in bodies/signatures (off by default).
Normalizes (lowercase/trim), validates (simple RFC regex), and dedupes by address.
Customer success watchlist: list of all stakeholders per account domain.
Security sweep: detect unexpected personal domains that shouldn’t be in sensitive threads.
Community ops: harvest speaker/attendee contacts from event inbox labels.
Churn rescue: surface domains that went quiet (no messages since X days).
Billing hygiene: find role accounts (e.g., ap@, billing@) across customers.
Get the script (free)
Want this Gmail → Sheets harvester? Email Stacy Cook and he’ll send the script and a 2-minute setup guide (paste into Apps Script, set your query & Sheet ID, run in dry-run first).
FAQ
Does it include BCC recipients? If you sent the message, Gmail keeps your BCCs for your copy—yes. Otherwise, BCC of others isn’t visible.
Will it pull newsletters? Only if your query includes Promotions/Forums. We default to excluding them.
Multiple mailboxes? Use delegation or run the script per account and append to the same Sheet with a source_account column.
Will this hit quotas? We batch reads, backoff on limits, and checkpoint. For huge mailboxes, let it run nightly increments.
If you want a tailored version (e.g., body signature parsing, CRM push, merge with website signups), tell Stacy Cook what you need—we’re happy to share and tweak. 🚀
a. Want a version that pushes directly to HubSpot/Close and tags contacts with first_seen/last_seen? b. Prefer a one-click UI (menu + dialog) where you paste the search query and pick the Sheet?