Unable to write Table data from email to excel

Hey,
I am trying to filter last 10 emails with subject “Site Daily Performance Update” and all these emails have a table. I just want to extract this table and Past append in an excel however, I am unable to do it. Could any one help with this. Attached the email example screenshot and Main file
Main.xaml (14.7 KB)

@girishankar09 - What I’d do is For Each Email Message I extract, I would get their HTML Body using the Headers property:

currentItem.Headers("HTMLBody")

And then I would extract the table with Regex:

System.Text.RegularExpressions.Regex.Match(strHTML, "(<table(.+))(</table>)").ToString

image

And then save that as a temporary HTML file:
image

Then open that file in the Browser and proceed to data scrape as per usual:

I used the Table Extraction option and it works great:
image

May need to do some modifications on the extraction options as the headers of your table does not seem to correspond to the actual columns but rather label-and-data pairs of their own.

Hope this helps!

1 Like

Thanks @argin.lerit , it worked perfectly, just wanted to check if there is a way to get the table into excel including the format like color bold etc

1 Like

@girishankar09 - Really glad it worked for you!

If the headers are the only ones that have formatting, I’d make an Excel template that has the correct formatting and then use that when writing the extracted DataTable.

If the rows may change formatting, it’s a little bit more complex but first thing that comes to mind is use RegEx to find all <TD> elements in the table HTML code, find out if there’s bold/color formatting in the styling and then proceed to match that with the DataRows contents and perform the necessary changes with activities such as:

Thanks!

Thank you for the explanation :slight_smile:

1 Like

Can you share any workflow file

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.