Open source · Python · Jun 2026
Outlook Daily Email Summary
One Python file that reads today's Inbox and Sent Items and keeps a daily Excel report, safe to run as often as you like.
Public repository · MIT licence
The demo runs in your browser on a made-up inbox for a made-up Wednesday. It does not connect to Outlook, and nothing you do here leaves the page. The script itself needs Windows, Microsoft Outlook and Python.
What it does
The script connects to Microsoft Outlook on Windows through COM, using pywin32, and reads today's email from the Inbox and Sent Items. It counts what was sent, received and replied to, and measures how long the emails were. It ranks the people who wrote to you, the people you wrote to and the domains your mail came from, and it tallies when in the day mail arrived and went out.
The results go into a formatted Excel workbook, DailyEmailSummary.xlsx, written with openpyxl. A Daily Log sheet keeps one row per day across 17 columns. Each day also gets a Detail sheet with the rankings, the hourly traffic, attachment counts and sizes, an approximate response time and the most common words in subject lines.
Run it as often as you like
Every Outlook email has an EntryID that stays the same across restarts. The script keeps the EntryIDs it has counted in email_tracking.json, next to the raw tallies for the day. A run at 10 am, another at 2 pm and a last one at 5 pm end with one row that covers the whole day.
Scan
Find today's email in the Inbox and Sent Items.
Skip
Drop any email whose EntryID is already in the tracking file.
Merge
Add the new emails to the day's running tallies.
Recompute
Work out every statistic again from the merged tallies.
Save
Write the tracking file, then update today's row and Detail sheet.
How it is built
- Language
- Python, one file
- Runs on
- Windows with Outlook
- Writes
- Excel workbook and JSON
- Licence
- MIT
- Python
- pywin32
- openpyxl
- Excel
Outlook's Restrict filter pulls only today's items by their received or sent time. If the filter fails, the script falls back to a slower scan of the whole folder. Only mail items are counted, so meeting requests and other item types are left out.
Replies come from the reply time Outlook keeps on each received email. The response time pairs a sent email with the first email received in the same conversation, and only counts gaps of up to a day.
A batch file runs it with a double-click. On the first run that creates the workbook, the script prints the steps to schedule it daily in Windows Task Scheduler.
Run it on a made-up day
The demo runs in your browser on a made-up inbox for a made-up Wednesday. It does not connect to Outlook, and nothing you do here leaves the page. The script itself needs Windows, Microsoft Outlook and Python.
Pick a time, then run the script. Email arrives through the day, and each run only counts what is new. Run it again at the same time to watch it skip everything it has already counted.
Synthetic mailbox
Wednesday 4 March 2026, made up
Runs in your browser
Time only moves forward. Start the day again to pick an earlier time. Runs so far: 0
- counted
- arrived, not counted yet
- not arrived yet
The day's email, oldest firstInbox 0/20 · Sent Items 0/10
- 07:58InIT Service DeskServer maintenance window tonight · not arrived yet
- 08:12InJordan LeeQuarterly report draft · 1 attachment · replied 08:40 · not arrived yet
- 08:30InWeekly DigestWeekly digest: data and analytics · not arrived yet
- 08:40OutTo: Jordan LeeRE: Quarterly report draft · not arrived yet
- 08:47InSam PatelData request for the dashboard · replied 09:20 · not arrived yet
- 09:05InMei ChenTeam lunch on Friday · replied 09:15 · not arrived yet
- 09:15OutTo: Mei Chen; Jordan LeeRE: Team lunch on Friday · not arrived yet
- 09:20OutTo: Sam PatelRE: Data request for the dashboard · 1 attachment · not arrived yet
- 09:41InFinance TeamInvoice 4471 for March · 2 attachments · not arrived yet
- 10:20InJordan LeeRE: Quarterly report draft · replied 11:05 · not arrived yet
- 10:55InChris WalkerTraining calendar for April · 1 attachment · not arrived yet
- 11:05OutTo: Jordan LeeRE: Quarterly report draft · 1 attachment · not arrived yet
- 11:30InSam PatelRE: Data request for the dashboard · 1 attachment · replied 12:10 · not arrived yet
- 12:05InIT Service DeskPassword expiry reminder · not arrived yet
- 12:10OutTo: Sam PatelRE: Data request for the dashboard · not arrived yet
- 12:40InPriya NairSurvey results for review · 2 attachments · replied 13:30 · not arrived yet
- 13:15InMei ChenRE: Team lunch on Friday · not arrived yet
- 13:30OutTo: Priya Nair; Chris WalkerRE: Survey results for review · not arrived yet
- 13:50InJordan LeeDashboard figures for the board pack · replied 15:10 · not arrived yet
- 14:25InWeekly DigestWebinar: data quality in practice · not arrived yet
- 14:40OutTo: Finance TeamExpense claim for the conference · 1 attachment · not arrived yet
- 14:58InFinance TeamRE: Invoice 4471 for March · not arrived yet
- 15:10OutTo: Jordan LeeRE: Dashboard figures for the board pack · 1 attachment · not arrived yet
- 15:30InSam PatelData request: second extract · 1 attachment · replied 16:05 · not arrived yet
- 15:52InChris WalkerRE: Training calendar for April · not arrived yet
- 16:05OutTo: Sam PatelRE: Data request: second extract · not arrived yet
- 16:20InPriya NairRE: Survey results for review · replied 16:45 · not arrived yet
- 16:44InIT Service DeskMaintenance moved to Thursday · not arrived yet
- 16:45OutTo: Priya NairRE: Survey results for review · not arrived yet
- 16:58InJordan LeeRE: Dashboard figures for the board pack · not arrived yet
Console
Nothing has run yet. Pick a time and run the script.
Workbook · DailyEmailSummary.xlsx
Sheet names, columns and section titles follow the script's English output.
DailyEmailSummary.xlsx is created by the first run that finds email.
What the demo changes
The inbox is invented. The people, teams, subjects and timings are made up, and every address ends in .example.
Each made-up email carries a fixed word count and size. The script counts the words in the email body after stripping HTML, and reads the size from Outlook.
Two of the script's rules are kept as they are. A reply is read when an email is first counted, so a reply sent after that run is not added later. Response times pair emails found in the same run, so a reply to an email an earlier run counted gets no response time. One run at 17:00 counts every reply.
Source: rNLKJA/Outlook-Mail-Counting on GitHub, MIT licence. The demo is a browser port of the script's counting rules, written for this page.