How to copy specific table within Outlook email and keep format

Hello, UiPath community!

This is my first time working with Outlook in UiPath. I am trying to read in a specific table within an Outlook email (which contains many other tables) so that I can have UiPath perform actions depending on the table contents. Each table has a title before it (seen in the attached image), so that is how I was hoping to isolate the table I needed.
So far, I have been able to read in the full content of the email body and put it into a Word document using GetOutlookMailMessages. However, the problem is that it seems to store everything as a string which results in the table format not being kept, and each table cell is put onto a separate line. I am hoping that I can get the table I need in its original format into Word/Excel/DataTable so I can then read in the values from it.
Does anyone have a suggestion on how I might accomplish this? Thank you in advance!

@MK50

First of all try getting the body as html using mail.Headers("HTMLBody")

Now paste the data into a text file and save as .html file…

Then open the file using open browser and then use table extraction to extract the table as datatable

Hope this helps

Cheers

1 Like

Thank you so much, @Anil_G! I have the email contents as a .html – do you (or anyone else seeing this) happen to know of an activity I could use to extract a table after a specific string, in my case “Scheduled Maintenance” as that is the title of the table? There are many tables in this email so I need to get the correct one; I have been researching on this but haven’t found a clear solution yet. No worries if not!

@MK50

On the ui …you can try identifying the required value and the corresponding table using the required name as anchor… this is one method…

Then second method is to use regex or split operations and get the table part only after the specified name and before the constant part after the table…this way the table part can be extracted separately…

Str.Split({"Scheduled Maintainance"},StringSplitOptions.None)(1).Split("tableendIdentifier",StringSplitOptions.None)(0)

Hope this helps

Cheers

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