How to export emails from Outlook to Excel automatically?
Normally, you can export emails from Outlook to Excel using the Import/Export feature. However, if you need to automatically export incoming emails to an Excel file as they arrive, Outlook does not provide a built-in solution. This article introduces two methods to accomplish this:
Automatically Export New Incoming Emails from the Inbox to Excel Using VBA (Manual & Tedious)
Quickly Export All Emails from a Selected Folder to an Excel Report with Kutools for Outlook π (Fast & Easy)
Automatically Export New Incoming Emails from the Inbox to Excel Using VBA
If you need an automated way to export new emails to Excel, you can use the following VBA code. This method monitors the Inbox folder and exports new email details to an Excel file as soon as they arrive.
Step 1: Prepare the Excel File
Before executing the VBA code, set up an Excel workbook to store the exported email data. In the first row, include the following column headers: No., Sender Name, Sender Email Address, Subject, and Received Time.
Step 2: Open the VBA Editor in Outlook
1. Press Alt + F11 to open the Microsoft Visual Basic for Applications window.
2. In the Project1 (VbaProject.OTM) pane, expand Microsoft Outlook Objects and double-click ThisOutlookSession.
Step 3: Insert the VBA Code
Copy and paste the following VBA code into the module:
Public WithEvents GMailItems As Outlook.Items
Private Sub Application_Startup()
Set GMailItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub GMailItems_ItemAdd(ByVal Item As Object)
Dim xMailItem As Outlook.MailItem
Dim xExcelFile As String
Dim xExcelApp As Excel.Application
Dim xWb As Excel.Workbook
Dim xWs As Excel.Worksheet
Dim xNextEmptyRow As Integer
On Error Resume Next
If Item.Class <> olMail Then Exit Sub
Set xMailItem = Item
' Update this path with your actual Excel file path
xExcelFile = "C:\Users\DT168\Desktop\split document\kto-data.xlsx"
If IsWorkBookOpen(xExcelFile) = True Then
Set xExcelApp = GetObject(, "Excel.Application")
Set xWb = GetObject(xExcelFile)
If Not xWb Is Nothing Then xWb.Close True
Else
Set xExcelApp = New Excel.Application
End If
Set xWb = xExcelApp.Workbooks.Open(xExcelFile)
Set xWs = xWb.Sheets(1)
xNextEmptyRow = xWs.Range("B" & xWs.Rows.Count).End(xlUp).Row + 1
With xWs
.Cells(xNextEmptyRow, 1) = xNextEmptyRow - 1
.Cells(xNextEmptyRow, 2) = xMailItem.SenderName
.Cells(xNextEmptyRow, 3) = xMailItem.SenderEmailAddress
.Cells(xNextEmptyRow, 4) = xMailItem.Subject
.Cells(xNextEmptyRow, 5) = xMailItem.ReceivedTime
End With
xWs.Columns("A:E").AutoFit
xWb.Save
End Sub
Function IsWorkBookOpen(FileName As String)
Dim xFreeFile As Long, xErrNo As Long
On Error Resume Next
xFreeFile = FreeFile()
Open FileName For Input Lock Read As #xFreeFile
Close xFreeFile
xErrNo = Err
On Error GoTo 0
Select Case xErrNo
Case 0: IsWorkBookOpen = False
Case 70: IsWorkBookOpen = True
Case Else: Error xErrNo
End Select
End Function
Step 4: Enable Microsoft Excel Object Library
1. In the Microsoft Visual Basic for Applications window, click Tools > References.
2. In the References - Project1 dialog box, scroll down and check the Microsoft Excel Object Library option.
3. Click OK to apply changes.
Step 5: Save and Restart Outlook
1. Save the VBA code and close the editor.
2. Restart Outlook for the changes to take effect.
Result:
From now on, every new email arriving in the Inbox will be automatically exported to the specified Excel workbook.
Limitations of the VBA Method:
- β Works for One Inbox Only: This method only tracks new emails in the default Inbox. If you have multiple accounts, it wonβt capture emails from other accounts.
- β Requires Macro-Enabled Outlook: VBA macros must be enabled for this to function, which can pose security concerns.
- β File Path Dependency: If the Excel file is moved or deleted, the code will fail.
- β Manual Setup Required: Users must manually input the Excel file path and set up the VBA environment.
π Smarter Email Statistics with Kutools
Easily track and analyze your email activity with Kutools for Outlookβs Statistics feature. Now count received emails by day, week, or month, and view results in clear, professional charts! Streamline your email management and gain valuable insights with just a few clicks.

Quickly Export All Emails from a Selected Folder to an Excel Report with Kutools for Outlook π
If you need a hassle-free way to export emails from any folder (Inbox, Sent Items, Custom Folders) without using VBA, Kutools for Outlookβs Quick Report feature provides a simple solution.
Say goodbye to Outlook inefficiency! Kutools for Outlook makes batch email processing easier - now with free AI-powered features! Download Kutools for Outlook Now!!
Step 1: Select the Folder and Enable the Quick Report Feature
1. Open Outlook and navigate to the folder you want to export (Inbox, Outbox, Sent Items, etc.).
2. Click Kutools Plus > Report > Quick Report.
Step 2: Choose Save Location
1. In the Save Report window, choose a location and enter a file name for the export.
2. Click Save.
Step 3: Open the Exported Report
A confirmation message will appear. Click Yes to open the exported file.
Result:
All emails from the selected folder will be exported to an Excel-friendly XML file, displaying the sender, subject, received time, and more.
Advantages of Kutools for Outlook Method:
- β Works with Any Folder: Export emails from Inbox, Sent Items, Outbox, or custom folders.
- β No VBA Required: No need to enable macros or edit code.
- β Multi-Account Support: Export emails from multiple email accounts effortlessly.
- β Time-Saving: A few clicks generate an instant report.
- β Customizable Data Export: Choose which details (subject, sender, date, etc.) to include.
Which Method Should You Use?
Hereβs a comparison of the two methods to help you decide which one best suits your needs:
Method | Best For | Ease of Use | Efficiency |
---|---|---|---|
Using VBA Code (Automated but Complex) | Automatically exporting new emails from the Inbox | ββ | ββββ |
Using Kutools for Outlook (Simple and Flexible) | Quickly exporting all emails from a selected folder | βββββ | βββββ |
By selecting the right method, you can efficiently export Outlook emails to Excel based on your workflow needs!
Related Articles
- Export Email Body Table To Excel In Outlook
- When you receive an Email that contains some tables in the body, sometimes, you may need to export all tables from the message body to an excel worksheet. Normally, you can copy and paste the tables to worksheet, but, here, I will talk about a useful method to solve this job when there are multiple tables needed to be exported.
- Extract Or Export Tasks List To Excel In Outlook
- While using Outlook, you can extract the task list to Excel for other usage. With the powerful Export feature in Outlook, you can easily export your tasks list to Excel. Please do as below tutorial shows.
- Export Contactsβ Information With Photos In Outlook
- When you export contacts from Outlook to a file, only the text information of the contacts can be exported. But, sometimes, you need the photos to be exported as well as the contactsβ text information, how could you deal with this task in Outlook?
- Export Folder Structure From Outlook To Excel
- This article, I will introduce how to export folder structure of an account from Outlook to Excel file. Please achieve it with the details of this article.
Best Office Productivity Tools
Breaking News: Kutools for Outlook Launches Free Version!
Experience the all-new Kutools for Outlook with 100+ incredible features! Click to download now!
π€ Kutools AI : Uses advanced AI technology to handle emails effortlessly, including replying, summarizing, optimizing, extending, translating, and composing emails.
π§ Email Automation: Auto Reply (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
π¨ Email Management: Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
π Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
π Interface Magic: πMore Pretty and Cool Emojis / Remind you when important emails come / Minimize Outlook Instead of Closing ...
π One-click Wonders: Reply All with Attachments / Anti-Phishing Emails / πShow Sender's Time Zone ...
π©πΌβπ€βπ©π» Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Use Kutools in your preferred language β supports English, Spanish, German, French, Chinese, and 40+ others!


π One-Click Download β Get All Office Add-ins
Strongly Recommended: Kutools for Office (5-in-1)
One click to download five installers at once β Kutools for Excel, Outlook, Word, PowerPoint and Office Tab Pro. Click to download now!
- β One-click convenience: Download all five setup packages in a single action.
- π Ready for any Office task: Install the add-ins you need, when you need them.
- π§° Included: Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint