Read table from outlook mail body

Hi,

There is html table in mail body. We have read html table and paste it in excel file. How we can acheive that ?

@Shirish Have you tried this Activity :

Could u please help - How to use it. I have downloaded it.

@Shirish How many Tables will be present in the email? Will it be always 1 or more than 1 ?

only one table

@Shirish Go to Manage Packages in Studio , And Install the Activity Shown in the Image below :

cant find it…

@Shirish Go to Settings in Manage Packages and make sure you have selected all the Package Sources and try finding the Activity again.

Got it. When I am using it, it is throwing error.

Error is - System.NullReferenceException: Object reference not set to an instance of an object… Can u please check…
at Get_DataSet_from_MailMessage.ExtractTablesFromEmail.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

image

@Shirish Apologies for not informing earlier, In the HTMLText Property of ExtractTable Activity use item.Headers(“HTMLBody”).ToString, Considering that you have changed the Type Argument in For Each to System.Net.MailMessage

ok…how to add dataset to excel ??

@Shirish So were you able to extract the Data ? Also how do you want the Data in the Excel ? One Sheet Should Contain All the table data or Should it be in different Sheets?

there is no such property is available…

@Shirish Ohh The I guess you’re using a different version or a Different Activity, It’s ok, You can use the same Activity. Can you tell me what is the mail variable in the Mail Message Property?

Also Can you Provide the Workflow , I can update and send you back.

ExtractDataFromEmail.zip (14.4 KB)

Also tell how to write data to Excel from dataset

@Shirish How do you want the tables in Excel ? All the Tables from Different Email Mesages to be combined or should it be in different Sheets ?

in different sheet

@Shirish Check if this Works :
ExtractDataFromEmail.zip (16.7 KB)

This code is not extracting table from email body

@Shirish Does it give errors ?