How to save outlook email to excel

Get data from outlook into an excel worksheet

You can save Outlook emails to Excel by exporting them as a CSV (Comma Separated Value) file and then opening the file in Excel. Here's how to do it:

this is a manual method
  1. Open Microsoft Outlook
  2. Select the email messages you want to export to Excel
  3. Right-click and choose "Save As"
  4. In the "Save As" dialog box, choose "CSV (Comma Separated Values)" as the file type.
  5. Give the file a name and choose a location to save it.
  6. Open the exported CSV file in Microsoft Excel.

Once the file is open in Excel, you can format and manipulate the data as needed.

Auto method

you can export Outlook email to Excel using Visual Basic (VB) scripting. The code will require using Microsoft Excel and Microsoft Outlook Object Libraries. This can be achieved by using the Outlook application's object model to access the email data and then using the Excel application's object model to create a new workbook and write the email data to it.


Please follow our steps 

import outlook data to excel


after you can see this window




how to save outlook email to excel


then copy bellow code and run (you should change the email and folder name



Sub SaveOutlookEmails() Dim objOutlook As Object Dim objNamespace As Object Dim objFolder As Object Dim objMail As Object Dim objExcel As Object Dim objWorkbook As Object Dim objWorksheet As Object Dim intRow As Integer 'Create objects Set objOutlook = CreateObject("Outlook.Application") Set objNamespace = objOutlook.GetNamespace("MAPI") Set objFolder = objNamespace.Folders("mmdcreation@gmail.com").Folders("mmd1") Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Add Set objWorksheet = objWorkbook.Worksheets(1) 'Add headers to the Excel sheet objWorksheet.Cells(1, 1).Value = "Subject" objWorksheet.Cells(1, 2).Value = "From" objWorksheet.Cells(1, 3).Value = "To" objWorksheet.Cells(1, 4).Value = "Sent On" objWorksheet.Cells(1, 5).Value = "Body" 'Populate the data in the Excel sheet intRow = 2 For Each objMail In objFolder.Items objWorksheet.Cells(intRow, 1).Value = objMail.Subject objWorksheet.Cells(intRow, 2).Value = objMail.SenderName objWorksheet.Cells(intRow, 3).Value = objMail.To objWorksheet.Cells(intRow, 4).Value = objMail.SentOn objWorksheet.Cells(intRow, 5).Value = objMail.Body intRow = intRow + 1 Next 'Save the Excel file objWorkbook.SaveAs "C:\Users\Hp\Desktop\eml\New folder\test.csv" 'Release the objects objWorkbook.Close objExcel.Quit Set objMail = Nothing Set objFolder = Nothing Set objNamespace = Nothing Set objOutlook = Nothing End Sub



now try to run the button, if not work tell us your error, and we will show some common errors and a solution 

if you see this error, then 


  1. Go to the VBA editor (press Alt + F11 in Excel)
  2. Go to Tools -> References
  3. Click the "Browse" button at the bottom of the References dialog
  4. Locate and select the file "Microsoft.Office.Interop.Excel.dll" (usually found in the "C:\Program Files\Microsoft Office\Root\OfficeXX" folder, where XX is the version number of Office installed on your computer)
  5. Click OK on the References dialog and then click OK again in the Browse dialog

This should add a reference to the Microsoft Excel Object Library in your VBA project, and you should no longer receive the "User Defined type not defined" error when trying to declare a variable of type "Excel.Application".



User Defined type not defined


if you face another error tell us we will help you  you can see our video for more information





thank you 




Post a Comment

0 Comments