Ready script: mailbox → Excel in 10 minutes
If you do not want to debug IMAP encoding yourself, this is the finished version: one command, one Excel file.
What you get
mail_to_excel.py— one script, standard library +openpyxl.- Date filter (
--days), folder selection, sender and subject filters. - Columns: date, sender, email, subject, short text, attachments, size.
- README with app-password setup for Gmail, Yandex, Mail.ru, Outlook.
- Read-only access — the script never deletes or marks messages as read.
Run it
pip install openpyxl
python mail_to_excel.py --host imap.gmail.com --user you@gmail.com --days 30 --out mail.xlsx
Who it is for
| Role | Use case |
|---|---|
| Accountant | Monthly invoices and correspondence export |
| IT admin | Mailbox audit, migration checks |
| Recruiter | Applications and CV attachments |
| Ops / VA | Inbox clean-up and reporting |
Honest limits
- It does not OCR scanned PDFs and does not parse invoice amounts — that is a separate step.
- Very large mailboxes (50k+) need a date filter and a few minutes of patience.
- Corporate Microsoft 365 tenants may require OAuth instead of an app password.
Payment: USDT (TRC-20) to a wallet, delivery is automatic — the download link appears right after the transfer. No signup, no subscription.
FAQ
Do I need to know Python?
No. You install two things and run one command. The README lists the exact commands for Windows, macOS and Linux.
Does it work offline?
It needs network access to your mail server only. Nothing is uploaded anywhere else.
What if my provider requires OAuth?
Gmail and personal Outlook work with app passwords. Corporate tenants may need OAuth — ask IT, the script structure stays the same.
Is there a refund?
If the file does not arrive or does not run, contact support — we resend or refund the USDT.
Related guides
- How IMAP export worksThe method and the code behind the script.
- AttachmentsBulk-save files from the same mailbox.