Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

Help Needed: Parsing HTML Stored in SharePoint Column into Power Apps Collection

Like (0) ShareShare
ReportReport
Posted on 8 Feb 2024 07:53:13 by 42

Greetings Power Apps Community,

I'm encountering an issue with extracting HTML content from a SharePoint list column and am seeking advice or strategies for dealing with it. My SharePoint list, called wodata, has a column named Items that contains information in an HTML table format. This format encompasses details such as items, unit rates, quantities, and totals, as shown below:

Content from the column is as follows:

PowerFlames_0-1707378131231.png

and This is content of the column: 

 

<div class="ExternalClass05230F9BE097400790F53A3414976C22"><table border="1" width="100%"><tr><th>Item</th><th>Unit Rate</th><th>Quantity</th><th>Total (USD)</th></tr><tr><td>Purchase of Dongles 4</td><td>$ 44</td><td>8</td><td>$ 352</td></tr><tr><td>Purchase of books</td><td>$ 16</td><td>97</td><td>$ 1552</td></tr><tr><td>Purchase of Cups</td><td>$ 5</td><td>20</td><td>$ 100</td></tr></table></div>

 

PowerFlames_1-1707378416388.png

My objective is to transfer this information into a Power Apps collection to enable further manipulation, display, and modification within my application. Nevertheless, I'm finding it challenging to directly parse the HTML content within Power Apps, given the platform's limited HTML parsing capabilities. Specifically, I'm looking to populate a collection with the HTML data when an item is selected for viewing or editing.

Given the restrictions of my Power Apps license, incorporating Power Automate into Power Apps isn't an option for me.

I would greatly appreciate any assistance or alternative solutions that do not involve Power Automate.

 

  • Cat Schneider Profile Picture
    488 Most Valuable Professional on 24 Feb 2024 at 01:15:28
    Re: Help Needed: Parsing HTML Stored in SharePoint Column into Power Apps Collection

    @PowerFlames just checking in to see if you were able to get something working for you?

  • Verified answer
    Cat Schneider Profile Picture
    488 Most Valuable Professional on 20 Feb 2024 at 15:05:30
    Re: Help Needed: Parsing HTML Stored in SharePoint Column into Power Apps Collection

    I've previously demo'd the below function during the Power Platform Community Call (specifically back in September 2022)

    With({i:
     Substitute(Substitute(Substitute(Substitute(Substitute(
     ParserJSON.Run(recString.Text).rtntable
     , "<td></td>", "<td>null</td>")
     , "&#39;", "'")
     , "&amp;", "&")
     , "&quot;", Char(34))
     , "&nbsp;", " ")
     },
     
     With({ 
     cols: MatchAll(i, "\<th\>(?<th>.+?)(?=\<\/th\>)\<\/th\>", MatchOptions.Multiline),
     rows: MatchAll(i, "\<tr\>(?=\<td)(?<tr>.+?)(?=\<\/tr\>)\<\/tr\>", MatchOptions.Multiline)
     },
     
     With({
     colsCt: CountRows(cols), 
     rowsCt: CountRows(rows)
     },
     
     With({rcV:
     
     Ungroup( 
     
     ForAll(Sequence(rowsCt) As r, 
     
     With({
     td: MatchAll(Index(rows, r.Value).tr, "\<td\/\>|\<td\>\s*(?<td>.+?)?(?=\s*\<\/td\>)\s*\<\/td\>", MatchOptions.Multiline)
     },
     {
     RW: r.Value, 
     CV: ForAll(Sequence(colsCt) As c, 
     {
     COL: c.Value, 
     FLD: Index(cols, c.Value).th, 
     VAL: With({vC: Index(td, c.Value).td}, If(vC <> "null", Substitute(Substitute(vC,"&lt;","<"),"&gt;",">")))
     }
     )
     }
     )
     ),
     "CV"
     )},
     ClearCollect(jsonObjDetails, rcV)
     )
     )
     )
    ) 


    The parserJson.Run function is a call to a Power Automate flow to get and return a JSON string as a string of HTML formatted as a Table. Since your string is already formatted as a table, you could manipulate this function to use your string instead of calling the Power Automate flow. Then it should output all the same. (note: you may need to drop the div tags and possibly the table formatting, to get it all to work appropriately.) Once everything was output to the collection, I just used the jsonObjDetails for the items of my gallery.

    Let me know if you still need an assist getting this to fit your project.

  • PowerFlames Profile Picture
    42 on 08 Feb 2024 at 11:37:53
    Re: Help Needed: Parsing HTML Stored in SharePoint Column into Power Apps Collection

    @NPPlatform thanks for the efforts, but this is HTML table within power apps, but i want fetch from a column in SharePoint list which has few divs as well. it doesn't work for me sadly. I know it's very complex, i hope i'll get someone that can support. 

     

  • NPPlatform Profile Picture
    606 Super User 2025 Season 1 on 08 Feb 2024 at 09:51:28
    Re: Help Needed: Parsing HTML Stored in SharePoint Column into Power Apps Collection

    Hi, sadly I don't know of an easy way to go about this. There is, however, a post already on this forum about converting a html-table. You can find it here: https://powerusers.microsoft.com/t5/Building-Power-Apps/Converting-html-table-into-galley/td-p/1926838.

     

    Hopefully this helps you out!

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 Winners! 🌸

Congratulations to all our community participants!

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 > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 106 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 75

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 52 Super User 2025 Season 1

Overall leaderboard