Office365 Email body doesn't show tab characters but GetOutlookMailMessages does

Hello, I have an automation that until now I was using GetOutlookMailMessages Activity to get an email that has a table in the email body, but now I have to replace it with Office365 GetMail Activity.

The table in the email body is prepared from an email template that can’t be changed, and I have to extract some values from that table.

The issue I have is that with GetOutlookMailMessages, in the mail body i could find tab characters between each cell value, so I was using that to split the body to an array, but with Office365 GetMail it seems that there are no tab characters, I believe they are replaced by space characters, but the spacing is not the same in every place so I can’t just split the text at every 4 spaces for example. There were places that there was only one space between the values of 2 cells, so I am kind of stuck on how to proceed.

Thank you

Hello

Can you provide a sample of Office365 mail body and deidentify the information if you need.

Are the columns constant / known?

Cheers

Steve

Hello,
I managed to fix my issue, even though it got a bit messy.

  1. First i get Email.BodyAsHTML
  2. Replace <br> , &nbsp; and NewLine with a space character
  3. Remove using regex <span>, <a>, <strong> tags, while keeping the text between each opening and closing tag
  4. Split using regex at every <td> tag, keeping the text between each opening and closing tag
  5. For each splitted item in the List, Split using regex at every remaining type of tag, keeping the text between each opening and closing tag, and add everything from that into a list of strings
  6. After all that remove any items from the list of strings that are EmptyOrWhitespace and trim the rest.

I tested it with about 50 emails that were already processed with the previous activity, and it produced the same results.

Here is an example of a table, if you want to have a crack at it

Example.html (12.3 KB)

Example


















Value 1: Value 1 Value 3: 12345 
Date:29-06-2024 Invoice to:Value
Name 1
Address 1
Name 2
Address 2
email
Value 2: Value 123
Location:City  Customer Ref:Value  

DescriptionPrice/EUR 
1Description 1123.00
2Description 2123.50
3Description 3
123.00
4Description 4
12.00
5Description 550.00
6Description 6150.00
7Description 730.00



TOTAL / EUR  1234.50


















1 Like