Skip to main content
Nintex Community Menu Bar

Parse HTML from a table in an email body

  • December 7, 2016
  • 6 replies
  • 43 views

Forum|alt.badge.img+7

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?

6 replies

Forum|alt.badge.img+14
  • Scholar
  • December 7, 2016

you should be able to parse HTML with Query XML action

maybe you just copied incorrect structure


Forum|alt.badge.img+7

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.


Forum|alt.badge.img+14
  • Scholar
  • December 21, 2016

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

one single regular expression action should do the job.


Forum|alt.badge.img+7

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.


rhia
Nintex Partner
Forum|alt.badge.img+15
  • Nintex Partner
  • April 14, 2017

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


Forum|alt.badge.img+3
  • May 2, 2019

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