Skip to main content

Notifications

Community site session details

Community site session details

Session Id : dCvNWEXmeT3JtYMVRHnJ/Y
Power Automate - Building Flows
Answered

How to parse HTML table from email to JSON

Like (0) ShareShare
ReportReport
Posted on 27 Jan 2024 02:40:52 by 14

Hello everyone!

 

I'm trying to parse as JSON the following HTML Table which comes from email:

<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%; border-collapse:collapse">
	<tbody>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border-top:solid #E4E4E5 1.0pt; border-left:none; border-bottom:solid #E4E4E5 1.0pt; border-right:none; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value1: </span>
					</b>
				</p>
			</td>
			<td valign="top" style="border-top:solid #E4E4E5 1.0pt; border-left:none; border-bottom:solid #E4E4E5 1.0pt; border-right:none; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 1</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value2:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 2</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value3:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">
						<a href="https://google.com">Content 3</a>
					</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value4:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 4</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value5:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 5</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value6:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 6</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value7:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"/>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value8:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 8</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value9:&nbsp;</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 9</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value10:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 10</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value11:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 11</span>
				</p>
			</td>
		</tr>
		<tr>
			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
				<p class="MsoNormal">
					<b>
						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value12:</span>
					</b>
				</p>
			</td>
			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"/>
		</tr>
	</tbody>
</table>
</td>
</tr>
<tr>
	<td style="padding:11.25pt 11.25pt 11.25pt 11.25pt">
		<p class="unsub">
			<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Text </span>
			<span class="notifyname1">
				<span style="font-family:&quot;Arial&quot;,sans-serif">Text Text Text Text</span>
			</span>
			<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"> Text, click <a href="mailto:test@test.com">Unsubscribe</a> Text Text Text Text.</span>
		</p>
		<p class="MsoNormal">
			<span style="font-size:9.0pt; font-family:&quot;Arial&quot;,sans-serif; color:#C8C9C7">© company. All rights reserved.</span>
			<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"/>
		</p>
	</td>
</tr>
</tbody>
</table>
</div>
<div>
	<p class="MsoNormal">
		<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">&nbsp;</span>
	</p>
</div>
<div>
	<p class="MsoNormal">
		<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Ref:XXXXXXXXX</span>
	</p>
</div>
<p class="MsoNormal">&nbsp;</p>
<p style="margin:5.0pt">
	<span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span>
</p>
<p class="MsoNormal">&nbsp;</p>
<p style="margin:5.0pt">
	<span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span>
</p>
<p class="MsoNormal">&nbsp;</p>
<p style="margin:5.0pt">
	<span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span>
</p>
</div>
</body>
</html>

 

 

 

You can paste this HTML on https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default to have a better visualization if necessary.


Here is the format of HTML table:

FGirardi_0-1706359777901.png

 

I tried to follow below articles but no lucky:

https://powerusers.microsoft.com/t5/Building-Flows/Parsing-HTML-table/m-p/791991#M110115

https://powerusers.microsoft.com/t5/Building-Flows/extract-the-content-from-table-in-email-to-sharepoint-list/m-p/688649#M92893

 

Also tried to follow below videos from @Paulie78 but no lucky:

 

How to use Power Automate to parse a HTML Table and convert to JSON
https://www.youtube.com/watch?v=IwRKWaTnl3U

 

Parsing Text from email with Microsoft Power Automate
https://www.youtube.com/watch?v=7tZ6bRtco3Y

 

I think I'm not getting because the way my table is formatted is different from all tables provided on above samples.

 

My table has a 'Menu' values on each row instead on the header for each column and I'm guessing this is why I'm not getting the expected results.

 

I don't know how to transforme the data to JSON, I'm stuck here on the last step:

 

Image link: https://ibb.co/MD1McXN

 

Untitled.png

 

Thank you in advanced.

  • zfbfgfg Profile Picture
    on 05 Mar 2024 at 16:39:54
    Re: How to parse HTML table from email to JSON

    Edit:Fixed it..

  • FGirardi Profile Picture
    14 on 02 Feb 2024 at 13:42:02
    Re: How to parse HTML table from email to JSON

    Hello @DeniseDL,

     

    I have figured out my case by doing the following:
    1 - After have my JSON, I converted it to string.
    2 - After convert JSON to String, I removed the '},{' which was causing multiple objects into the JSON.

    3 - Parse the output again to JSON.

     

    FGirardi_0-1706881105376.png

     

    convertString

    string(body('Parse_JSON'))

    replaceKeyComma

    replace(string(outputs('convertString')),'},{',',')

     

     

  • Chriddle Profile Picture
    7,678 Super User 2025 Season 1 on 02 Feb 2024 at 12:56:35
    Re: How to parse HTML table from email to JSON

    Since the HTML code is relatively clean, you can replace the entire flow with just a Select and a Compose using xml() and xpath():

    Chriddle_1-1706878295414.png

     

    Compose

    The HTML

     

    Spoiler (Highlight to read)
    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%; border-collapse:collapse">
    	<tbody>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border-top:solid #E4E4E5 1.0pt; border-left:none; border-bottom:solid #E4E4E5 1.0pt; border-right:none; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value1: </span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border-top:solid #E4E4E5 1.0pt; border-left:none; border-bottom:solid #E4E4E5 1.0pt; border-right:none; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 1</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value2:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 2</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value3:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">
    						<a href="https://google.com">Content 3</a>
    					</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value4:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 4</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value5:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 5</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value6:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 6</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value7:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"/>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value8:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 8</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value9:&nbsp;</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 9</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value10:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 10</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value11:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 11</span>
    				</p>
    			</td>
    		</tr>
    		<tr>
    			<td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in">
    				<p class="MsoNormal">
    					<b>
    						<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value12:</span>
    					</b>
    				</p>
    			</td>
    			<td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"/>
    		</tr>
    	</tbody>
    </table>
    </td>
    </tr>
    <tr>
    	<td style="padding:11.25pt 11.25pt 11.25pt 11.25pt">
    		<p class="unsub">
    			<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Text </span>
    			<span class="notifyname1">
    				<span style="font-family:&quot;Arial&quot;,sans-serif">Text Text Text Text</span>
    			</span>
    			<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"> Text, click <a href="mailto:test@test.com">Unsubscribe</a> Text Text Text Text.</span>
    		</p>
    		<p class="MsoNormal">
    			<span style="font-size:9.0pt; font-family:&quot;Arial&quot;,sans-serif; color:#C8C9C7">© company. All rights reserved.</span>
    			<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"/>
    		</p>
    	</td>
    </tr>
    </tbody>
    </table>
    </div>
    <div>
    	<p class="MsoNormal">
    		<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">&nbsp;</span>
    	</p>
    </div>
    <div>
    	<p class="MsoNormal">
    		<span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Ref:XXXXXXXXX</span>
    	</p>
    </div>
    <p class="MsoNormal">&nbsp;</p>
    <p style="margin:5.0pt">
    	<span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span>
    </p>
    <p class="MsoNormal">&nbsp;</p>
    <p style="margin:5.0pt">
    	<span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span>
    </p>
    <p class="MsoNormal">&nbsp;</p>
    <p style="margin:5.0pt">
    	<span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span>
    </p>
    </div>
    </body>
    </html>
    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%; border-collapse:collapse"> <tbody> <tr> <td width="185" valign="top" style="width:138.75pt; border-top:solid #E4E4E5 1.0pt; border-left:none; border-bottom:solid #E4E4E5 1.0pt; border-right:none; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value1: </span> </b> </p> </td> <td valign="top" style="border-top:solid #E4E4E5 1.0pt; border-left:none; border-bottom:solid #E4E4E5 1.0pt; border-right:none; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 1</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value2:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 2</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value3:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"> <a href="https://google.com">Content 3</a> </span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value4:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 4</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value5:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 5</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value6:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 6</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value7:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"/> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value8:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 8</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value9:&nbsp;</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 9</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value10:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 10</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value11:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Content 11</span> </p> </td> </tr> <tr> <td width="185" valign="top" style="width:138.75pt; border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"> <p class="MsoNormal"> <b> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Value12:</span> </b> </p> </td> <td valign="top" style="border:none; border-bottom:solid #E4E4E5 1.0pt; padding:7.5pt 0in 7.5pt 0in"/> </tr> </tbody> </table> </td> </tr> <tr> <td style="padding:11.25pt 11.25pt 11.25pt 11.25pt"> <p class="unsub"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Text </span> <span class="notifyname1"> <span style="font-family:&quot;Arial&quot;,sans-serif">Text Text Text Text</span> </span> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"> Text, click <a href="mailto:test@test.com">Unsubscribe</a> Text Text Text Text.</span> </p> <p class="MsoNormal"> <span style="font-size:9.0pt; font-family:&quot;Arial&quot;,sans-serif; color:#C8C9C7">© company. All rights reserved.</span> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E"/> </p> </td> </tr> </tbody> </table> </div> <div> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">&nbsp;</span> </p> </div> <div> <p class="MsoNormal"> <span style="font-family:&quot;Arial&quot;,sans-serif; color:#0E0E0E">Ref:XXXXXXXXX</span> </p> </div> <p class="MsoNormal">&nbsp;</p> <p style="margin:5.0pt"> <span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span> </p> <p class="MsoNormal">&nbsp;</p> <p style="margin:5.0pt"> <span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span> </p> <p class="MsoNormal">&nbsp;</p> <p style="margin:5.0pt"> <span style="font-size:7.0pt; color:#737373">Internal Use - Confidential</span> </p> </div> </body> </html>

     

     

     

    Select

    From

     

    xpath(
    	xml(
    		replace(
    			slice(
    				outputs('Compose'),
    				indexOf(outputs('Compose'), '<table'),
    				add(
    					indexOf(outputs('Compose'), '</table>'),
    					8
    				)
    			),
    			'&nbsp;',
    			' '
    		)
    	),
    	'//tr'
    )

     

    Map key

     

    trim(
    	xpath(
    		item(),
    		'string(//td[1])'
    	)
    )

     

    Map value

     

    trim(
    	xpath(
    		item(),
    		'string(//td[2])'
    	)
    )

     

     

    Compose 2

     

    first(
    	json(
    		replace(
    			string(body('Select')),
    			'},{',
    			','
    		)
    	)
    )

     

     

    Result:

     

    {
     "Value1:": "Content 1",
     "Value2:": "Content 2",
     "Value3:": "Content 3",
     "Value4:": "Content 4",
     "Value5:": "Content 5",
     "Value6:": "Content 6",
     "Value7:": "",
     "Value8:": "Content 8",
     "Value9:": "Content 9",
     "Value10:": "Content 10",
     "Value11:": "Content 11",
     "Value12:": ""
    }

     

     

  • DeniseDL Profile Picture
    20 on 02 Feb 2024 at 12:35:16
    Re: How to parse HTML table from email to JSON

    This is amazing!  Thank you thank you thank you!  You are a miracle worker.

    Have yourself a great day!

    Denise

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 02 Feb 2024 at 12:27:25
    Re: How to parse HTML table from email to JSON

    Hi @DeniseDL 

     

    Pls write the below expression in "From" parameter of Select action to avoid getting duplicates:

    range(0,1) 

     

    You could use parse action to parse the output of select action and then use create item action to add the rows in SharePoint list.

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • DeniseDL Profile Picture
    20 on 02 Feb 2024 at 12:16:23
    Re: How to parse HTML table from email to JSON

    This is amazing!  Thank you so much for your help with this.  I have been trying to figure this out for a very long time.  I am also a beginner.  My only concern is that my output seems to be repeated.  Is this correct?

    DeniseDL_0-1706876093972.png

    Also, would this be where I add in the action to populate my SharePoint List?  I'm just so amazed that I lost sight of my end goal😊

     

    Thank you again!

    Denise

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 02 Feb 2024 at 05:29:02
    Re: How to parse HTML table from email to JSON

    Hi Denise,

     

    I have a sample for you.

     

    After filter array action, add compose action that stores the heading of all the questions as an array. This is optional as you could hard coded those headers in the key column of Map parameter in select action (next action):

    ManishSolanki_0-1706851308252.png

    [
    "Internal / External",
    "Type",
    "Barrier",
    "Region",
    "Feedback / Question",
    "Response Requested",
    "Email address"
    ]

     

    Next, add "Select" action and write an expression in the "From" parameter:

    ManishSolanki_1-1706851403836.png

    range(0,1)

    Expression used for Key/Value in Map parameter:

    Key Value
    outputs('Compose')?[0]
    trim(join(skip(split(body('Filter_array')?[0],'^'),1),''))
    outputs('Compose')?[1]
    trim(join(skip(split(body('Filter_array')?[1],'^'),1),''))
    outputs('Compose')?[2]
    trim(join(skip(split(body('Filter_array')?[2],'^'),1),''))
    outputs('Compose')?[3]
    trim(join(skip(split(body('Filter_array')?[3],'^'),1),''))
    outputs('Compose')?[4]
    trim(join(skip(split(body('Filter_array')?[4],'^'),1),''))
    outputs('Compose')?[5]
     
    trim(join(skip(split(body('Filter_array')?[5],'^'),1),''))
    outputs('Compose')?[6]
    trim(join(skip(split(body('Filter_array')?[6],'^'),1),''))

     

    The output body of Select action will give the required JSON object.

     

    Output:

    ManishSolanki_2-1706851671145.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • DeniseDL Profile Picture
    20 on 01 Feb 2024 at 20:51:20
    Re: How to parse HTML table from email to JSON

    Hello,

    I just came across your solution to this problem and since I have the same or similar problem, I tried it and it got me closer to what I need to do.

     

    My table looks like this:

    DeniseDL_0-1706819166024.png

    I have gone through the same video:  

    How to use Power Automate to parse a HTML Table and convert to JSON
    https://www.youtube.com/watch?v=IwRKWaTnl3U

     

    My Filter array output is:

    [
            "1. I am a^DFO or CCG employee^",
            "2. What do you want toprovide feedback on?^Accessibility Barrier^",
            "3. Select all the areasthat are relevant to your comments^Physical environment (door knob, ramp, elevator, etc.)^",
            "4. Choose the region you are providing feedback about^DFO-Pacific^",
            "5.Describe the issue and providecomments.^Test #3^",
            "6.Do you want us to contact you about your feedback?^Yes, I’m comfortable providing my email address for contact purposes only.^",
             "Email address^denise.richard@dfo-mpo.gc.ca^"
        ]
    When I use your solution, I get the output:
    [ { "1. I am a^DFO or CCG employee^": "1. I am a^DFO or CCG employee^" }, { "2. What do you want toprovide feedback on?^Accessibility Barrier^": "2. What do you want toprovide feedback on?^Accessibility Barrier^" }, { "Describe the item you want to provide feedbackon^This isn't on the table^": "Describe the item you want to provide feedbackon^This isn't on the table^" }, { "3. Select all the areasthat are relevant to your comments^Physical environment (door knob, ramp, elevator, etc.)^" }, { "4. Choose the region you are providing feedback about^DFO - Pacific^": "4. Choose the region you are providing feedback about^DFO - Pacific^" }, { "5.Describe the issue and providecomments.^Test #3.^": "5.Describe the issue and providecomments.^Test #3^" }, { "6.Do you want us to contact you about your feedback?^Yes, I’m comfortable providing my email address for contact purposes only.^": "6.Do you want us to contact you about your feedback?^Yes, I’m comfortable providing my email address for contact purposes only.^",{"Email address^denise.richard@dfo-mpo.gc.ca^": "Email address^denise.richard@dfo-mpo.gc.ca } ]
     
    I have a question and answer on each line separated by ^ 
    I would like it to come out like this:
    Internal / External: DFO or CCG employee
    Type: Accessibility Barrier
    Barrier: Physical environment (door knob, ramp, elevator, etc.)
    Region: DFO - Pacific
    Feedback / Question: Test #3
    Response Requested: Yes, I'm comfortable providing my email address for contact purposes only
     
    This is a screenshot of my flow so far before the select action:
    DeniseDL_1-1706820652352.png

     

     
    I'm going to be using this to populate a SharePoint List once it's parsing the information correctly.
     
    Any help you can give me would be great!

    Thank you!

    Denise

  • FGirardi Profile Picture
    14 on 29 Jan 2024 at 18:25:26
    Re: How to parse HTML table from email to JSON

    Hello @ManishSolanki,

     

    There is a way to put all content in the same JSON Object instead multiple objects?

     

    This JSON is getting multiples objects, and since I'm using a condition to filter for specific value to do a specific action based on the value (post message in different teams channels based on different values) I'm not able to get all objects infos.

     

     

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 27 Jan 2024 at 15:06:19
    Re: How to parse HTML table from email to JSON

    Hi @FGirardi 

     

    No Problem. I am glad that your problem is resolved 🙂

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started