cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Removing HTML Script from data in Query Editor

Hi everyone,

 

I'm trying to remove all text between < and > including the carrots from a column in Query Editor.

 

I thought about splitting the column with the ? being the delimiter, then creating a column with "?", and then concatenating but the first example wants shows that there are cells with styling before the question mark.

 

Thanks in advance!

 

Here are two examples:

 

Click <b>YES/b> if you watched the Super Bowl?

 

Did you watch the Super Bowl?<span style="font-size:14px !important; display: block;">Click YES if you did.</span>

<div id="disclaimer-1">You may be eligible for a free high five if you watched the Super Bowl.</div>

<style type="text/css" id="customCSS">
.Qid1 .answers{
position: relative;
top: -130px;
}

.Qid1 #disclaimer-54269{
position: relative;
top: 175px;
display: block;
width: 100%;
margin: auto;
text-align: justify;
font-size: 10px;
line-height: 16px;
color: #999;
}

@media all and (min-width: 600px){
.Qid1 .answers{
top: -120px;
}
.Qid1 #disclaimer-54269{
font-size: 12px;
line-height: 20px;
}
}

@media all and (min-width: 601px){
.Qid1 .answers{
top: -75px;
}
.Qid1 #disclaimer-54269{
top: 175px;
float: none;
display: block;
width: 100%;
}
}

@media all and (min-width: 900px){
.Qid1 #disclaimer-54269{
top: 85px;
}
}

</style>

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Removing HTML Script from data in Query Editor

I transformed it into a proper function here 🙂 https://github.com/ImkeF/M/blob/master/Library/Text.RemoveHtmlTags.pq

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

20 REPLIES 20
Highlighted
Super User IV
Super User IV

Re: Removing HTML Script from data in Query Editor

Web.Page("your html") or this technique:

 

https://social.technet.microsoft.com/Forums/en-US/473b2c06-7845-4df7-846a-d350ee84e942/remove-html-t...

 

Maybe @ImkeF has some more tricks up her sleeve.


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Super User III
Super User III

Re: Removing HTML Script from data in Query Editor

I transformed it into a proper function here 🙂 https://github.com/ImkeF/M/blob/master/Library/Text.RemoveHtmlTags.pq

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Highlighted
Frequent Visitor

Re: Removing HTML Script from data in Query Editor

Thank so much for transforming into a proper function!

 

I just have some beginner level follow-up questions on how to implement the M script.

 

The data file I'm using is calle "SurveyResponses_Age&Vertical" 

Should I be replacing  Source = Text.From(HTML) to Source = Text.From(SurveyResponses_Age&Vertical) ?

 

Is it best to use the Advanced Editor, and if so, how what's the proper syntax for that?

 

 

Thanks!

Highlighted
Super User III
Super User III

Re: Removing HTML Script from data in Query Editor

Please see if this video helps: https://www.youtube.com/watch?v=6TQN6KPG74Q

If not, please come back here.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Highlighted
Regular Visitor

Re: Removing HTML Script from data in Query Editor

I am connecting to a SharePoint Online List.  Is there a way to use this code to remove the HTML Script for the data when I load?  Thanks.

Highlighted
Regular Visitor

Re: Removing HTML Script from data in Query Editor

Hello my friend!

 

I´m having the same issue. Did You get a solution?

 

Thanks.

 

Dan

Highlighted
Regular Visitor

Re: Removing HTML Script from data in Query Editor

Highlighted
Microsoft
Microsoft

Re: Removing HTML Script from data in Query Editor

Awesome , you made my day very easy and simple. Thank you so much...

Highlighted
Helper V
Helper V

Re: Removing HTML Script from data in Query Editor

@ImkeF Can you please provide guidance on where and how to insert this code? I am assuming it's to be inserted somewhere within the existing code found within the Advanced Editor?

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors