Export Researcher emails to Excel
Four steps, one command, and a completeness check at the end — for literature and interview correspondence.
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 participant,topic,consent,date,source --out researcher.xlsx
Step 2 — filter to one period
A month or a quarter, not «everything». Consent and correspondence are part of the research record. An index protects both the study and the participants.
Step 3 — keep only the columns that matter
| Column | Why it matters |
|---|---|
participant | Pseudonymised participant id, never the real name. |
topic | The subject of the commitment or conversation. |
consent | Consent status (yes / no / withdrawn) — never inferred. |
date | Message date in ISO 8601; sortable and unambiguous across time zones. |
source | Where the application came from (job board, referral, inbound). |
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
| participant | topic | consent | date | source |
|---|---|---|---|---|
| P-014 | onboarding | signed | 2026-10-11 | interview |
Pitfalls
- Participant identities leak into the dataset — Store pseudonyms in the export and keep the mapping in a separate, access-controlled file.
- Consent status is unclear — Add a consent column with yes/no/withdrawn and never infer it.
Provider notes
University Exchange often blocks app passwords; use the institution’s approved export path.
FAQ
Does this comply with GDPR?
Only if you minimise data and document purpose. The export itself is neutral; your handling decides.
Can I keep email bodies?
Only with consent and a retention rule; metadata is usually enough for an index.
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
- Researcher: columns and pitfallsThe compact overview for this role.
- Universal IMAP guideApp passwords, decoding and Excel output.