web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to parse HTML tabl...
Power Automate
Unanswered

How to parse HTML table from email to JSON

(0) ShareShare
ReportReport
Posted on 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.

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @FGirardi 

     

    Pls check out if my blog would be helpful for you. In that blog, I have shown how could we extract html table from email:

    Extract data from html table from email body in Power Automate - Microsoft Power Platform (manish-solanki.com)

     

     

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

     

  • FGirardi Profile Picture
    14 on at

    Hello @ManishSolanki,


    Thank you for reply back.

     

    Your article doesn't help because your table has the same structure as the others I found previously.

     

    I think my problem is because I don't know how to manipulate my table since there is a different format (The headers are not in the first row, they are in first column of each row).

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @FGirardi 

     

    One question, are the headers fixed (column 1 -12) in your case? I mean no of rows are fixed in the html table (1-12).

     

     

  • FGirardi Profile Picture
    14 on at

    @ManishSolanki,

     

    Yes, the headers will be always fixed on each row as provided sample.

     

    Also I may used the wrong name convention to the samples. I have changed and edited my post with information as 'Value' and 'Content'.

     

    HTML will be always with below format:

     

    'Value1' has Name and 'Content 1' has 'FirstName'.
    Name: FirstName LastName

     

    'Value2' has Address and 'Content 2' has 'Street 1, 111'.
    Address : FirstName LastName

     

    FGirardi_0-1706362224083.png

     

  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @FGirardi 

     

    Apologies for my previous replies. I think the ask was to convert array in JSON object array so here the sample for you:

     

    I have stored the input array in the compose action:

    ManishSolanki_0-1706363342959.png

    [
    "Column1: Value 1",
    "Column2: Value 2",
    "Column3: Value 3 [https://google.com/]",
    "Column4: Value 4",
    "Column5: Value 5",
    "Column6: Value 6",
    "Column7: ",
    "Column8: Value 8",
    "Column9: Value 9",
    "Column10: Value 10",
    "Column11: Value 11",
    "Column12: "
    ]

     

    Next, add Select action to convert to JSON array. Pass the output of previous compose action as input and add expressions in both key & value of map parameter:

    ManishSolanki_1-1706363509991.png

    Expression used for key:

    trim(first(split(item(),': ')))

    Expression used for value:

    trim(last(split(item(),': ')))

     

     

    Output

     

    ManishSolanki_2-1706363609429.png

     

    I hope this would solve your problem.

     

     

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

     

  • FGirardi Profile Picture
    14 on at

    Awesome @ManishSolanki.

    I have no words to say thank you. It worked perfectly.

    I'm new user of PowerAutomate, I'm not a developer and maybe I miss something on programming logic to find this solution.

     

    Thank you again!

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @FGirardi 

     

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

     

     

  • FGirardi Profile Picture
    14 on at

    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.

     

     

  • DeniseDL Profile Picture
    20 on at

    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

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    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.

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard