Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power Query - HTML

Hi, 
I want to extract the text from html retaining the formatting. I used html.table function but it is not giving the desired output
input:
<ol style="list-style-image: none; list-style-type: decimal;"><li>Test by me</li><li>Testing</li></ol>
output:( when I used html.table it's givig output as below)
Test by meTesting

expected output:

1)Test by me

2)Testing

Thanks in Advance!!!!!

 

 

@lbendlin @bcdobbs @parry2k @Greg_Deckler @PhilipTreacy 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

1. Click the column--> Split by Custom delimiter "<li>"

Eyelyn9_2-1646623198173.png

2. Select the two new columns--> Extract between delimiters:

Eyelyn9_3-1646623359313.png

3. Then you could remove the original column and Transpose the columns.

 

Here is the whole M syntax:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDBOzs9RKC6pzEm1jVHKySwu0QVzdDNzE9NTrRTy8vNSrRWQxEsqC4DCKanJQAU51jEQM1IhJuVkQnghqcUlCkmVCrlQcX2YBKayzLx0rGr083MgXKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter("<li>", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3"}),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Split Column by Delimiter", {{"Column1.2", each Text.BeforeDelimiter(_, "</li>"), type text}, {"Column1.3", each Text.BeforeDelimiter(_, "</li>"), type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Extracted Text Before Delimiter",{"Column1.1"}),
    #"Transposed Table" = Table.Transpose(#"Removed Columns")
in
    #"Transposed Table"

 

Final output:

Eyelyn9_4-1646623436539.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

1. Click the column--> Split by Custom delimiter "<li>"

Eyelyn9_2-1646623198173.png

2. Select the two new columns--> Extract between delimiters:

Eyelyn9_3-1646623359313.png

3. Then you could remove the original column and Transpose the columns.

 

Here is the whole M syntax:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDBOzs9RKC6pzEm1jVHKySwu0QVzdDNzE9NTrRTy8vNSrRWQxEsqC4DCKanJQAU51jEQM1IhJuVkQnghqcUlCkmVCrlQcX2YBKayzLx0rGr083MgXKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter("<li>", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3"}),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Split Column by Delimiter", {{"Column1.2", each Text.BeforeDelimiter(_, "</li>"), type text}, {"Column1.3", each Text.BeforeDelimiter(_, "</li>"), type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Extracted Text Before Delimiter",{"Column1.1"}),
    #"Transposed Table" = Table.Transpose(#"Removed Columns")
in
    #"Transposed Table"

 

Final output:

Eyelyn9_4-1646623436539.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

edhans
Super User
Super User

Before parsing the data, you could replace all </li> strings with ***</li>, then use the Split Columns feature on the *** string.

 

Other that that, I'd need to see some data because you've  not given enough to use the Html.Table function in the above post.

 

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.