Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Extracting HTML Table from email to Excel

Like (0) ShareShare
ReportReport
Posted on 28 Mar 2022 20:40:05 by 46

Hi There,

                yes i am very new to this and i have followed many tutorials and they all seem to work fine with the example HTML and have given me a greater understanding of Power Automate, but when I try and apply what I've learned to my own HTML it just doesn't work and i've been going round in circles for quite some time. if someone could give me some pointers for my html that would be great.

 

 

<html><head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style>
 <!--
 @font-face
 {font-family:"Cambria Math"}
 @font-face
 {font-family:Calibri}
 @font-face
 {font-family:Cambria}
 @font-face
 {font-family:Tahoma}
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 {margin:0cm;
 font-size:11.0pt;
 font-family:"Calibri",sans-serif}
 span.EmailStyle21
 {font-family:"Calibri",sans-serif;
 color:windowtext}
 .MsoChpDefault
 {font-size:10.0pt}
 @page WordSection1
 {margin:72.0pt 72.0pt 72.0pt 72.0pt}
 div.WordSection1
 {}
 -->
 </style>
 </head>
 
 <body lang="EN-GB" link="blue" vlink="purple" style="word-wrap:break-word">
 <div class="WordSection1">
 <div>
 <div>
 <p><span lang="EN-US">Please find enclosed below detail of your recently raised call:- </span></p>
 <p><span lang="EN-US">WO# R2012051 Work Order Created</span></p>
 <p><span lang="EN-US">&nbsp;</span></p>
 <table class="MsoNormalTable" border="1" cellpadding="0" width="601" style="width:450.75pt">
 <tbody>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><a name="x_x__Hlk3181679"><b><span
 style="font-family:&quot;Cambria&quot;,serif">Reference
 Number:</span></b></a></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">R2012051</span></p>
 </td>
 </tr>
 <tr>
 <td style="padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Reported Date:</span></b></p>
 </td>
 <td style="padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">Feb 23 2022 3:58PM</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Reporter Name:</span></b></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">Mr Right</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Priority:</span></b></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">P4</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Estimated
 Completion:</span></b></p>
 </td>
 <td style="padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">Mar 23 2022 3:58PM</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span
 style="font-family:&quot;Cambria&quot;,serif">Actual&nbsp;Completion:</span></b>
 </p>
 </td>
 <td style="padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">N/A</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Building:</span></b></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">Any Building</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Location:</span></b></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">VARI </span></p>
 <p><span style="font-family:&quot;Cambria&quot;,serif">VARIOUS AREAS</span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Problem:</span></b></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><span style="font-family:&quot;Cambria&quot;,serif">Grounds Maintenance (Shrub
 Clearance / Litter Picking / Weeding etc):&gt;BN0039A1the grass outside needs
 trimming </span></p>
 </td>
 </tr>
 <tr>
 <td width="42%" style="width:42.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p><b><span style="font-family:&quot;Cambria&quot;,serif">Detail:</span></b></p>
 </td>
 <td width="58%" style="width:58.0%; padding:5.25pt 5.25pt 5.25pt 5.25pt">
 <p class="MsoNormal">No Details</p>
 </td>
 </tr>
 </tbody>
 </table>
 <p>&nbsp; </p>
 <p><span style="font-family:&quot;Times New Roman&quot;,serif">If you require any additional
 information, please call Someone else or email on: </span></p>
 <p>&nbsp;</p>
 <p style="margin-bottom:8.0pt; line-height:105%"><span
 style="font-family:&quot;Tahoma&quot;,sans-serif">Anyjob<span style="color:#435254"> Limited,
 Registered Office: </span>Your<span style="color:#435254"> House, </span>My<span
 style="color:#435254"> Place, London, W1</span>A<span style="color:#435254"> </span>2G<span
 style="color:#435254">B, registered in England and Wales No. </span>6561248<span
 style="color:#435254">.Regulated by the </span>myself<span
 style="color:#435254">.<br>&nbsp;<br>This communication is from </span>Anyjob<span
 style="color:#435254"> Limited or one of its associated/subsidiary
 companies.<br>&nbsp;<br>This communication contains information which is confidential and
 may be privileged. If you are not the intended recipient, please contact the sender
 immediately.<br>&nbsp;<br></span>Remember who you send this too<span style="color:#435254">,
 </span>may not send it on<span style="color:#435254">, </span>so dont<span
 style="color:#435254"> rely on its contents in any way whatsoever.<br>&nbsp;<br>Reasonable
 care has been taken to ensure that this communication (and any attachments or hyperlinks
 contained within it) is free from computer viruses.<br>No responsibility is accepted by
 </span>Anyjob<span style="color:#435254"> Limited or its associated/subsidiary companies and the
 recipient should carry out any appropriate virus checks.<br>&nbsp;<br>Details about the
 personal data </span>Anyjob<span style="color:#435254"> Limited collects and why, as well as
 your data privacy rights under applicable law, are available&nbsp;</span><span
 style="color:#003F2D">at&nbsp;</span></span>the&nbsp; Back door</p>
 </div>
 </div>
 </div>
 <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br><br>
 <hr style="border:none; color:#909090; background-color:#B0B0B0; height:1px; width:99%">
 <table style="border-collapse:collapse; border:none">
 <tbody>
 <tr>
 <td style="border:none; padding:0px 15px 0px 8px"><a href="https://www.avast.com/antivirus"><img
 border="0" src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo">
 </a></td>
 <td>
 <p
 style="color:#3d4d5a; font-family:&quot;Calibri&quot;,&quot;Verdana&quot;,&quot;Arial&quot;,&quot;Helvetica&quot;; font-size:12pt">
 This email has been checked for viruses by Avast antivirus software. <br><a
 href="https://www.avast.com/antivirus">www.avast.com</a> </p>
 </td>
 </tr>
 </tbody>
 </table><br><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a>
 </div>
 </body>
 
 </html>

 

 

 

I would like to be able to populate the below Spreadsheet on my onedrive with the data from the table in incoming emails.

 

defect excel.pngIf anyone knows of an example that would work with my HTML i would be happy to follow it if someone could point me in the right direction.

Kind Regards

Rick

  • SAK_Anantha Profile Picture
    13 on 30 Jun 2023 at 14:02:08
    Re: Extracting HTML Table from email to Excel

    Hi @DamoBird365 i checked your youtube video and i get the below error on trying to execute the same
    Unable to process template language expressions in action 'ComposeHTML' inputs at line '0' and column '0': 'The template language function 'xml' parameter is not valid. The provided value cannot be converted to XML: 'Reference to undeclared entity 'nbsp'. Line 1, position 2072.'. Please see https://aka.ms/logicexpressions#xml for usage details.'.
    Any help here is highly appreciated thank you

  • joshuaran Profile Picture
    6 on 07 Apr 2023 at 22:36:23
    Re: Extracting HTML Table from email to Excel

    Good afternoon, Thank you so much for completing this video. It has been a tremendous help. I have completed all the steps in the video but am encountering a strange issue. I have spent two full days at work trying to solve without any resolution. I have an email that I have been testing on with 4 rows. When the flow runs it counts 4 rows but the first row is the first column header. It then counts row two correctly and so on. I have tried adjusting the rowcount minus and range but no success. Here is a text stripped copy of the html code from the composehtml output. Its like its missing the second <tr> all together.

     

    <table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0"> <thead> <tr> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>Line #</b></p> </td> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>Line Description</b></p> </td> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>BOC</b></p> </td> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>Qty.</b></p> </td> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>Unit Price</b></p> </td> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>Est. Extended Price</b></p> </td> <td style="border:solid #DDDDDD 1.0pt; padding:6.0pt 6.0pt 6.0pt 6.0pt"> <p class="MsoNormal" align="center" style="text-align:center"><b>Justification</b></p> </td> </tr> </thead> <tbody> <tr> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">1</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">TEST</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">254B</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">1</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$0.00</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$0.00</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">tEST1 </p> </td> </tr> <tr> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">2</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">PtEST</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">254B</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">1</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$82.01</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$82.01</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">nOTHING. </p> </td> </tr> <tr> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">3</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">Primary</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">254B</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">1</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$124.83</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$124.83</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">nOTHING. </p> </td> </tr> <tr> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">4</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">Primary:</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">254B</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">1</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$82.01</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">$82.01</p> </td> <td style="padding:.75pt .75pt .75pt .75pt"> <p class="MsoNormal">nOTHING gate. </p> </td> </tr> </tbody> </table>
  • Community Power Platform Member Profile Picture
    on 24 Mar 2023 at 12:00:23
    Re: Extracting HTML Table from email to Excel

    Hi @DamoBird365 ,

     

    First of all thank you for your help, I've been watching your YouTube tutorial and the solution to this issue and I could solve part of this process, nevertheless I would like to ask for some help/advice in case the flow needs to extract multiple HTML tables from an unique email. The main problem/issue here is to define the start and end for each table and tell the flow to process each. I've tried to do it but only gets the first table and do the process as there's only one, also I've tried with joining all the tables in one but then appears an error like  "Unable to process template language expressions in action 'HTML' inputs at line '0' and column '0': 'The template language function 'xml' parameter is not valid. The provided value cannot be converted to XML: 'There are multiple root elements. Line 1, position 242718." or the error says that there are multiple tables without their closing tags.

     

    I hope you can help with this. Thank you.

     

    Best,

    Jose

  • lipster26 Profile Picture
    12 on 01 Sep 2022 at 17:49:56
    Re: Extracting HTML Table from email to Excel

    Hello,

     

    I'm trying to do this as well but can't determine the xpath expression in SelectRowsfromHTML for my table. How can i form the Key/Value to split out the table into headers/columns/rows? Thanks.

     

    <table class=MsoNormalTable border=1 cellpadding=0>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>FX Rate Type
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>From Currency
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>To Currency
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>Date1 FX Rate
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>Date1
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>Date2 FX Rate
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>Date2
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal align=center style='text-align:center'>
    <b>Same FX Rate?
    <o:p>
    </o:p>
    </b>
    </p>
    </td>
    </tr>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>E
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CLP
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CAD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>0.14537
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220831
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>0.14137
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220731
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    </td>
    </tr>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>E
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>EUR
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CAD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>1.31741
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220831
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>1.30593
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220731
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    </td>
    </tr>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>E
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>GBP
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CAD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>1.52460
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220831
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>1.55970
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220731
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    </td>
    </tr>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>E
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>JPY
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CAD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>0.94390
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220831
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>0.96080
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220731
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    </td>
    </tr>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>E
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>MXN
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CAD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>0.06520
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220831
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>0.06280
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220731
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    </td>
    </tr>
    <tr>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>E
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>USD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>CAD
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>1.30890
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220831
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>1.28020
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    <p class=MsoNormal>20220731
    <o:p>
    </o:p>
    </p>
    </td>
    <td style='padding:.75pt .75pt .75pt .75pt'>
    </td>
    </tr>
    </table>

  • ash2022 Profile Picture
    6 on 01 May 2022 at 17:03:59
    Re: Extracting HTML Table from email to Excel

    Thanks for the advice! The expression worked with only one key/value, but never more than one. I'm not savvy enough yet to understand why, so my workaround was to use the table header values directly. It isn't dynamic, but my table header values don't change, so that isn't an issue for me. I was then able to use the table header values in an Apply to each that created a SharePoint list item for each row of the email table (and incorporated some other data parsed from the body of the email as well).

     

    ash2022_0-1651424235820.png

    ash2022_1-1651424360217.png

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 27 Apr 2022 at 20:51:21
    Re: Extracting HTML Table from email to Excel

    Hi @ash2022 

     

    Not sure to be honest without seeing more of your logic. Try simplifying it with one key/value. Get that working and then extend it. It would be easier to start a new case if you are not sure.

     

    Damien

  • ash2022 Profile Picture
    6 on 27 Apr 2022 at 01:29:28
    Re: Extracting HTML Table from email to Excel

    Hi @DamoBird365

    I'm having the same exact issue as @pramodklal 

    Any advice on how to adjust the code?

    Thanks!

    ash2022_0-1651022942860.png

     

  • pramodklal Profile Picture
    14 on 31 Mar 2022 at 04:27:08
    Re: Extracting HTML Table from email to Excel

    Hi @DamoBird365 

    I am getting below error message at the step "SelectRowsFromHTML", please suggest

    how to remove this issue. TIA

    InvalidTemplate. The execution of template action 'SelectRowsFromHTML' failed: The evaluation of 'query' action 'where' expression '{ "@{xpath(xml(outputs('ComposeHTML')),'//table[1]//tr[1]/td[1]/text()')?[0]}": "@xpath(xml(outputs('ComposeHTML')),concat('//table[1]//tr[',item(),']/td[1]/text()'))?[0]", "@{xpath(xml(outputs('ComposeHTML')),'//table[1]//tr[1]/td[2]/text()')?[0]}": "@xpath(xml(outputs('ComposeHTML')),concat('//table[1]//tr[',item(),']/td[2]/text()'))?[0]", "@{xpath(xml(outputs('ComposeHTML')),'//table[1]//tr[1]/td[3]/text()')?[0]}": "@xpath(xml(outputs('ComposeHTML')),concat('//table[1]//tr[',item(),']/td[3]/text()'))?[0]" }' failed: 'Unable to evaluate template language expression '@{xpath(xml(outputs('ComposeHTML')),'//table[1]//tr[1]/td[2]/text()')?[0]}' as JSON property name: the property with name '' already exists.'.

     

    Error at SelectRowsFromHTMLError at SelectRowsFromHTML

    below 

  • DoctaShed Profile Picture
    46 on 30 Mar 2022 at 14:39:52
    Re: Extracting HTML Table from email to Excel

    Thanks Damien, using your solution made things a lot easier although i suspect after i have added my steps its a bit long and convoluted, i am working on getting the excel entries correct without the square brackets and quotes but i'm a lot further along than i was, so again thankyou very much for helping me out.

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on 29 Mar 2022 at 20:03:04
    Re: Extracting HTML Table from email to Excel

    Hi @DoctaShed 

     

    Take a look at Extract HTML Table from Email in Power Automate - YouTube

     

    This should get you started:

    DamoBird365_0-1648583755195.png

    Compose: your html sample

    Compose2: slice(outputs('Compose'),indexOf(outputs('Compose'),'<table'),indexOf(outputs('Compose'),'</table'))

    compose3: replace(outputs('Compose_2'),'&nbsp','')

     

    Note that in compose2 I also have the closing </table> tag

     

    Hope that helps you get up and running.

     

    Please consider accepting my answer as a solution if it helps to solve your problem.

    Cheers
    Damien

    Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started