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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
JrBIAnalyst
Frequent Visitor

Getting HTML data adjacent to a table (Table title/caption)

I'm working with a data reporting platform that provides outputs as HTML documents. I'd like to import those documents into Power BI to work with the data.

 

Each document has a series of forms and subforms (think workbook and worksheets) which are produced using HTML such as the following:

 

 

 

<div id='formID' class='title formTitle'>
  <hr>FORM NAME<hr>
</div>

<div class='title miniTitle'>SubForm_1_Name</div>

<table class='topTable'>
  <thead>
    <tr class='underlined'>
      <th scope='col' class='underlined'>Field</th>
      <th scope='col' class='underlined'>Column1</th>
      <th scope='col' class='underlined'>Column2</th>
      <th scope='col' class='underlined'>Total</th>
    </tr>
  </thead>
  
  <tbody>
    <tr>
      <td class='label labelWidth'>Field_Value</td>
      <td class='number numberWidth'>Column1_Value</td>
      <td class='number numberWidth'>Column2_Value</td>
      <td class='number numberWidth'>Total_Value</td>
	</tr>
  </tbody>
</table>

<div class='title miniTitle'>SubForm_2_Name</div>
<table> ... </table>

<div class='title miniTitle'>SubForm_3_Name</div>
<table> ... </table>

 

 

 

 

 

 

As you can see, the only place the name of the forms and subforms appears is in seperate divs before each table. Using the "Web" connector, its easy to get the actual content of the tables. Does anyone know of a way I can access the names of the forms? 

 

For completeness, the eventual goal is to unpivot everything and wind up with a data structure like:

Form_NameSubform_NameFieldColumn_NameValue

I don't anticipate callenges with the unpivot portion as soon as I can figure out how to access the Form and Subform names.

 

Thanks for your help!

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @JrBIAnalyst 

 

Download sample PBIX file

 

Open the file as text, filter for the titles then extract between delimiters to remove any html.

 

let
    Source = Table.FromColumns({Lines.FromBinary(File.Contents("d:\temp\forms.htm"), null, null, 1252)}),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Column1], "miniTitle") or Text.Contains([Column1], "<hr>")),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Filtered Rows", {{"Column1", each Text.BetweenDelimiters(_, ">", "<"), type text}})
in
    #"Extracted Text Between Delimiters"

 

html11.png

 

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!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @JrBIAnalyst 

 

Download sample PBIX file

 

Open the file as text, filter for the titles then extract between delimiters to remove any html.

 

let
    Source = Table.FromColumns({Lines.FromBinary(File.Contents("d:\temp\forms.htm"), null, null, 1252)}),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Column1], "miniTitle") or Text.Contains([Column1], "<hr>")),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Filtered Rows", {{"Column1", each Text.BetweenDelimiters(_, ">", "<"), type text}})
in
    #"Extracted Text Between Delimiters"

 

html11.png

 

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!


Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.