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
cjwilson80
Regular Visitor

Remove HTML and ?XML Tags & Script from Data

I'm new to "M" and I have a question that I think should be pretty simple but I can't find the right answer anywhere.

 

I am connected to a SharePoint List through Power  BI and a few of the columns in the data set are coming across like this: "<div class="ExternalClass7DF52B6F7B0440629625A19FD571B46D"><p>​xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p></div>"

 

I changed the text to "X's" for confidentiality. Anyway, How can I remove all the HTML script from all these columns and rows so that it just gives me the comments? I can't find anything about how to remove this from the entire data set so I'm hoping someone here can help.


I also have a column or two with <?xml> tags too, but should also only show the comments between the <> tags.

 

HELP!!

 

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @cjwilson80 ,

The code might help you. 

(HTML as text) =>
let
    Source = Text.From(HTML),
    SplitAny = Text.SplitAny(Source,"<>"),
    ListAlternate = List.Alternate(SplitAny,1,1,1),
    ListSelect = List.Select(ListAlternate, each _<>""),
    TextCombine = Text.Combine(ListSelect, "")
in
    TextCombine

There is a similar thread you can reference.

 

Best Regards,

Xue

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

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

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.