Export Virtual assistant emails to Excel
Four steps, one command, and a completeness check at the end — for inbox cleanup and daily reporting.
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 sender,priority,task,deadline,folder --out virtual-assistant.xlsx
Step 2 — filter to one period
A month or a quarter, not «everything». Assistants triage other people’s inboxes. A daily table turns «I think I saw it» into a tracked task list.
Step 3 — keep only the columns that matter
| Column | Why it matters |
|---|---|
sender | Who wrote in; used for triage and routing. |
priority | A fixed scale (high/normal/low) that you define once. |
task | The one-line action extracted from the message. |
deadline | ISO date — empty means «no deadline», which is itself information. |
folder | Source folder or label, so every row has a traceable origin. |
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
| sender | priority | task | deadline | folder |
|---|---|---|---|---|
| billing@vendor.com | high | Renew domain | 2026-10-22 | Admin |
Pitfalls
- The client’s mailbox gets marked as read — Open the folder read-only in the script — this is the default and must stay that way.
- Deadlines are missed because dates are text — Store dates in ISO 8601 and sort the column in the spreadsheet.
Provider notes
Shared mailboxes may need delegated access, which IMAP does not always support; check with the mailbox owner first.
FAQ
Will this work with a shared inbox?
Only if the provider exposes it over IMAP with your own credentials. Otherwise export per-user and merge.
Can I schedule the report?
Yes — run the script from cron or Task Scheduler every morning and email the file to yourself.
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
- Virtual assistant: columns and pitfallsThe compact overview for this role.
- Universal IMAP guideApp passwords, decoding and Excel output.