Power bi convert html to text

Hi @WJ876400 

You can deal with this error by usng try ... otherwise like so

try Html.Table([ColumnName] , {{"text",":root"}}) otherwise null

So if you encounter an error at this point, Power Query will just return null and the query won't stop at this step.

Regards

Phil

Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.

Blog :: YouTube Channel :: Connect on Linkedin

Proud to be a Super User!


Introduction

What should we do if we get an HTML tag in our data and we need only plain text? Confused? Don’t worry here is the solution. Today I am writing this article to solve this issue.

In Power BI we are able to transform our data using Power query editor. Below is the list of steps that you need to follow to remove HTML tags and get plain data.

Step 1

I have Excel data in the ‘InternetData’ table and column two i.e.’ Web’ has data in HTML form. Our task is getting the plain text of this column. See the below image.

Power bi convert html to text

Step 2

Now I am going to import this Excel data into Power BI. To do so, click on ‘Get data’ on the home tab and select ‘Excel’ as the source. Provide the file path, select the file and click ‘Ok’.

Power bi convert html to text

A new Navigator windows will be opened. Select the check box of the table and then click on ‘Load’.

Power bi convert html to text

The table has been loaded successfully and is showing on the right side of the BI tool. You can view the data of this table using table visualization. You can also change the format of the table visualization to show your data interactive.

Power bi convert html to text

Step 3

Now our task is to remove HTML tags from ‘Web’ column data. So we need to open the Power Query editor to do this task. Click on the ‘Transform data’ available on the ‘Home’ Tab.

Power bi convert html to text

Power bi convert html to text

Step 4

Now add a custom column in this table. Go to the ‘Add Column’ table and click on ‘Custom Column’. A new ‘Custom Column’ window will be opened.

Power bi convert html to text

Provide the custom column name in the ‘New Column Name’ box and also provide the DAX formula for removing HTML tags. The formula is given below.

  1. = Html.Table([ColumnName] , {{"text",":root"}})  

Put this formula in the ‘Custom Column Formula’ box and then click on ‘OK’. A custom column has been added now.

Power bi convert html to text

Power bi convert html to text

Click on the ‘Plain_Web_Text’ extend button (highlighted in above image).

Power bi convert html to text

Power bi convert html to text

To save changes, go to the file tab and click on ‘Close & Apply’.

Power bi convert html to text

A new column has been added and showing in Power BI.

Power bi convert html to text

Summary

These are the simple steps to remove HTML tags from the data. I hope you enjoy the article and that it helps you to solve your problem. Follow these steps and get plain text from the HTML tag. Thanks for reading, and have a nice day.

How do I convert HTML text to normal text in power bi?

Convert Data From HTML To Plain Text In Power BI.
I have Excel data in the 'InternetData' table and column two i.e.' Web' has data in HTML form. ... .
Now I am going to import this Excel data into Power BI. ... .
Now our task is to remove HTML tags from 'Web' column data. ... .
Now add a custom column in this table..

How do I convert HTML to text?

Below are several methods for converting, or saving, an HTML web page as a text document..
Click the File tab again, then click the Save as option..
In the Save as type drop-down list, select the Plain Text (*. txt) option. ... .
Click the Save button to save as a text document..

Can power bi display HTML?

The HTML Viewer allows you to display the results of HTML code within your Power BI reports.

How do I import HTML into power bi?

In the Power BI Desktop Home ribbon tab, drop down the arrow next to Get Data, and then select Web. You can also select the Get Data item itself, or select Get Data from the Power BI Desktop get started dialog, then select Web from the All or Other section of the Get Data dialog, and then select Connect.