Export E-commerce ops emails to Excel
Four steps, one command, and a completeness check at the end — for supplier and customer email tracking.
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 order,supplier,tracking,issue,status --out ecommerce-ops.xlsx
Step 2 — filter to one period
A month or a quarter, not «everything». Lost parcels and supplier delays are usually already in email before anyone updates the tracker.
Step 3 — keep only the columns that matter
| Column | Why it matters |
|---|---|
order | Order number — the join key with your e-commerce system. |
supplier | Who supplies the item; used for delay analysis. |
tracking | Carrier tracking number, stored in full. |
issue | Free-text problem description, kept short. |
status | Fixed vocabulary: open / in progress / done / blocked. |
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
| order | supplier | tracking | issue | status |
|---|---|---|---|---|
| ORD-77120 | ShenzhenParts | 1Z999AA10123456784 | delayed | open |
Pitfalls
- Tracking numbers arrive as images — Log the row and mark «manual» instead of silently dropping it.
- Supplier threads are buried in spam — Whitelist supplier domains before the export; otherwise the rows are missing.
Provider notes
Zoho and Fastmail work with app passwords; check IMAP is enabled in settings.
FAQ
Can this track returns?
Add a «direction» column (outbound/inbound) and filter it in the spreadsheet.
What about marketplace message systems?
Those are not IMAP; export them separately and merge by order number.
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
- E-commerce ops: columns and pitfallsThe compact overview for this role.
- Universal IMAP guideApp passwords, decoding and Excel output.