Extracting data table from e-mail message body

whitin the project I am working on I need to save within variable with type System.Data.DataTable data from the table placed within the Outlook e-mail message body. I have not found the way how to do it. :disappointed_relieved:
Table is simple - there are 6 columns, 4 rows, no merged cells.
So, I will be thankfull if someone can advice how to do it.

  1. Save the mail as WebPage(In outlook you can save the mail as a file then open it and use save as)
  2. Open the saved WebPage
  3. Then extract the data using extract datatable

Not sure how you can do it if you’re not using outlook.

1 Like

akhi_s27 thank you for your answer!

I have already tried following:

  1. saved mail message as html file using UiPath.Mail.Activities.SaveMail
  2. opened saved html file using UiPath.Core.Activities.OpenBrowser

As a result of this html file is being opened but it do not look like e-mail message - table is deformated. It looks like html elements are not presented correctly. So, unfortunately opened html cannot be used to scrape data table. As I am new user it looks like in the forum I cannot upload files to add an example of how html is being opened by UiPath.

akhi_s27, have I understood correct that steps I made are steps you proposed?
Maybe there are solution for this or another way how to extract data table from e-mail body?

Interesting that if I am manualy in Outlook saving mail message as html file and then opening the file in IE, html file is being opened correctly - such html could be used for data table scraping. So, the problem with correct saving/opening of html is only if it is being done by UiPath.
Anybody have ideas why it is so?

Hi VladisG did you find the solution I have same issue …

Hi, hkjobs1988, no I have not found solution.
One expert adviced me following via e-mail - “I looked at the problem – and I couldnt get the save email to save the email in a resonable html format. You can however open outlook, open the mail and save to html – that will be in a perfectly readable format.” I have not tried yet, but going to try.

If you or someone else found solution please let me know here.


Can you change the data and attach the mail message here?

Hi, akhi_s27,
as I am new user it looks like in the forum I cannot upload files.
I have example mail message, but how can I share it with you?


Any solution for this

Hi @VladisG @Kamesh , i had the same issue, and the only way to do it was to save the mail message with the extension *.mht (wich i discovered was a web page format for IE).
The datable is no longer disorted (only some typo due to the US encoding for French character).


ExtractHTMLTableFromEmailBody.xaml (10.0 KB)

Hi All,

Please find the sample workflow to extract Table from the Email body.Let me know if you are facing any issues.

Subhadharan Palanivel

Hi Subhadharan

Thanks! for sharing the xaml file it is useful but only thing in we are not able to save extracted data into .xls file or message box is coming as empty.

i have followed the exact solution u have shared.

pls share the solution i want the data to be saved as xls or csv file.

any fix is welcome.

Thanks in advance


I have downloaded the above ExtractHTMLTableFromEmailBody.xaml file after running message box returned as empty, pls let me if any modification required to be done xaml file.

This issue needs to be fixed ASAP, pls let me know the solution.


I had issues with extracting data using the above method and the issue was not with the XAML but rather with y IE settings.

After checking image in Internet options under the advanced tab it all started to work for me.

1 Like


If you have Excel license then you can save your message as EML file (by using Save Mail Message) and read your file within an Excel Application Scope, just like reading an xlsx file. The workbook path of the Excel Application Scope would be something like “mail.eml”

You will have to map the table based on the headers, but that’s easy.


Can you try this:
Hi @VladisG
Can you try below apporach.
1>get outlook mail message - filters are supported here.You can search through other posts on forum.
2>loop through the list to work on required email.
3>for the required email get the item.Headers("HTMLBody”).ToString
and store into a string variable using assign.
4>Now run the custom activity https://go.uipath.com/component/html-to-datatable On this html string to get the data tables which you can write into excel pr can directly iterate through.

All of this will happen in background👍

how to add email metadata into datatable
datatable columns : subject(String), body(String), attachmentName(String)