cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
andreapasutti
Nintex Newbie

Parse HTML from a table in an email body

We want our SQL database to send an email with a table of countries to a library. The workflow needs to run when the email arrives and reference only the table contents in the email body. Then the workflow will parse apart the table rows and populate a list with the data. I know how to do that part, I've developed this kind of workflow before, but we've always started with a .csv file.

What I can't figure out (because I'm still fairly new at HTML) is how to get the workflow to read the email. I found one thread that addresses this specific issue, but it's been dormant for a while and no solid solution given. The respondent suggested they use the Query XML action, save the contents to a "Multi String variable", and then use a Regular Expression to parse the information.

Not knowing what to do first, I thought I would start by viewing the source of one of the emails that was forwarded to me. I copied the HTML and pasted it into the Query XML action and clicked on the XPath builder tree view to see what I could see. I got an error message when I clicked on tree view that said "Error parsing xml: A string literal was expected, but no opening quote character was found." So then I played around with the HTML, but no luck. I really don't know what I'm doing.

I want my workflow to take an email, find the start of the table, and start parsing the data from there. How do I do that?

Labels: (2)
0 Kudos
Reply
6 Replies
emha
Nintex Newbie

Re: Parse HTML from a table in an email body

you should be able to parse HTML with Query XML action

maybe you just copied incorrect structure

0 Kudos
Reply
andreapasutti
Nintex Newbie

Re: Parse HTML from a table in an email body

When I manually enter neat HTML, like this:

<html>

<body>

<div>

<tr>p1</tr>

<tr>p2</tr>

<tr>p3</tr>

</div>

</body>

</html>

and process using this:

//tr

I get this:

p1

p2

p3

Very nice. This is exactly what I want. The problem is that my incoming email creates a lot of extra code before the table starts and the workflow can't parse the table apart. I know I can replace patterns with a Regular Expression, but there is a LOT of code. Surely this is possible and someone out there has done this before.

0 Kudos
Reply
emha
Nintex Newbie

Re: Parse HTML from a table in an email body

I'm not sure what you mean with ' lot of code with regular expression'...

one single regular expression action should do the job.

0 Kudos
Reply
andreapasutti
Nintex Newbie

Re: Parse HTML from a table in an email body

UPDATE: According to Vadim Tabakman, the email has been bae64 encoded and the workflow has no way of parsing that data. He thinks it may be possible with some code. I will update again when I have more information.

Reply
rhia
Nintex Newbie

Re: Parse HTML from a table in an email body

Was there any update to this? I'm looking for a way to crack open an .msg and parse its innards!

0 Kudos
Reply
nutenbary
Nintex Newbie

Re: Parse HTML from a table in an email body

may be no longer needed, but this thread may be helpful: Can NINTEX workflow read an email body from an email enabled library

0 Kudos
Reply