cancel
Showing results for 
Search instead for 
Did you mean: 

Populate HTML Table from Email to Collection

AmandaMiller
Level 2
Once I've gotten the raw HTML table code from an email, how can I parse it out to create a collection that I can load to a queue? Assume the table has a header row, and an unknown number of columns and rows.
1 REPLY 1

Anonymous
Not applicable
Assuming the table isn't consistently formatted, I don't foresee it to be easy. There are several possibilities which I would consider in the following order:  Excel should be able to open HTML files with tables. In this case, you may use the Excel VBO. This is rather quick to implement. Create a HTML document, open it in Internet Explorer and spy the lines. With the assumption in mind, you'll need dynamic properties You may create a wrapper around a HTML parsing engine, e.g. https://www.nuget.org/packages/HtmlAgilityPack . This one would take quite some time. Split the content by the tags, and parse the string manually. This one would be quite brittle. If you have good assumptions on the table's content (e.g. a new row always starts with a specific pattern), you may consider getting the text from the e-mail and trying to make sense of that. Whichever you chose, getting an e-mail's content is not a very reliable source, especially if they are not machine-generated. You should expect having to implement a lot of validations, data cleansing, etc.