Export Sales ops emails to Excel
Four steps, one command, and a completeness check at the end — for lead and follow-up tracking from email.
Step 1 — connect read-only
Use an app password, never the main password. The script opens the folder in read-only mode, so nothing is marked as read or deleted.
python mail_to_excel.py --host imap.example.com --user you@example.com --days 31 --fields lead,company,stage,owner,next_step --out sales-ops.xlsx
Step 2 — filter to one period
A month or a quarter, not «everything». Deals live in threads, not in the CRM. A weekly export catches everything that never reached the pipeline.
Step 3 — keep only the columns that matter
| Column | Why it matters |
|---|---|
lead | Contact name; deduplicate on email. |
company | Company name for B2B leads. |
stage | Pipeline stage as a fixed vocabulary, not free text. |
owner | The person responsible — assignments often happen in Cc. |
next_step | The single next action, written as a verb. |
Step 4 — verify completeness
- Run the same search in your mail client and note the message count.
- Compare it with the row count in the spreadsheet.
- If the numbers differ, the filter or the folder is wrong — fix it before using the file.
Example output
| lead | company | stage | owner | next_step |
|---|---|---|---|---|
| J. Smith | Orion Ltd | demo | A. Lee | send proposal |
Pitfalls
- Personal addresses mix with company leads — Add a «domain type» column (free mail vs company) instead of guessing intent.
- GDPR requests become impossible to answer — Keep an exported copy per period and delete on schedule; record deletion dates.
Provider notes
Gmail app passwords require 2FA; sales teams on Workspace should use OAuth to avoid admin blocks.
FAQ
Can this feed a CRM?
Export CSV and map columns to the CRM import format; deduplicate by email before importing.
How do I track follow-ups?
Add a «days since last reply» formula in the sheet — it surfaces stalled threads immediately.
How many messages can it handle?
Thousands per run with a date filter; very large mailboxes are better exported month by month.
Will it change anything in the mailbox?
No. Read-only access is the default and should stay enabled.
Related guides
- Sales ops: columns and pitfallsThe compact overview for this role.
- Universal IMAP guideApp passwords, decoding and Excel output.