Forum Discussion

JrBIAnalyst's avatar
JrBIAnalyst
Frequent Visitor
4 years ago
Solved

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...
  • PhilipTreacy's avatar
    4 years ago

    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"

     

     

    regards

     

    Phil