Extract Table from the Mail Body in Outlook

Hello Everyone,

I want to extract Table from Outlook Mail Body without using Data scraping. The input should be the Mail and Datatable should be the Output.

Can anyone help me

Hey @Asfaque ,

You can use the activity available in the marketplace.

Thanks,
Sanjit

Hi @Sanjit_Pal This custom activity is not supported in Windows Projects. It was available only for legacy based systems.

@Asfaque

  1. Use the “Get Outlook Mail Messages” activity to retrieve the desired email.
  2. Use a “For Each” loop to iterate through each email message.
  3. Within the loop, use an “Assign” activity to extract the HTML body of the email into a string variable. You can access the HTML body using the mailMessage.Body property.
  4. Use a regular expression pattern to extract the table from the HTML body. The pattern will depend on the structure and formatting of the table in the email. For example, if the table is enclosed in <table> and <tr> tags, you can use the pattern "<table.*?>(.*?)</table>" to match the entire table.
  5. Use the “Matches” activity and provide the HTML body string and the regular expression pattern to extract the table content. This activity will return a collection of matches.
  6. Iterate through the collection of matches using a “For Each” loop.
  7. Within the loop, use the “Assign” activity to extract the table content from each match using the match.Groups("1").ToString() expression. This will give you the content of the first capturing group in the regular expression pattern, which should be the table content.
  8. Convert the extracted table content into a DataTable using the “Generate DataTable” activity or by manually parsing the HTML content using custom logic.
  9. Perform any further processing or analysis on the extracted DataTable as needed.

Hi @Asfaque

Then you go with Data Scraping option after convert your email to HTML

Thanks,

Hey @raja.arslankhan

The above regex is not working. there is no table mentioned in the HTML text of the Mail, Although <\table> is present. I am actually confused here :sweat_smile:

Hi @RajKumar_DC

I don’t want it via DataScraping