Forum Discussion

reynaldo_malave's avatar
reynaldo_malave
Helper III
5 years ago
Solved

web.browsercontents and html.table not working and not loading entire table

 

Hi Devs, 

 

I am trying to get a httml table out of the following address "https://e.infogram.com/81277d3a-5813-46f7-a270-79d1768a70b2" at first i got a table which powerquery returned using html.table with 100 rows out of 346 but now it just returns the html code. 

 

I can see the table in the code near the end under "data": but i just dont know how to extract it.

 

Thanks in advance,

 

Reynaldo

  • The data is actually embedded in a javascript script, so you need to extract that part and then interpret as rows.

     

    let
    Source = Web.BrowserContents("https://e.infogram.com/81277d3a-5813-46f7-a270-79d1768a70b2"),
    d = Text.PositionOf(Source,"data"":[[["),
    e = Text.PositionOf(Source,"]]]"),
    j = Table.FromRows(Json.Document(Text.Range(Source,d+7,e-d-5))),
    #"Promoted Headers" = Table.PromoteHeaders(j, [PromoteAllScalars=true])
    in
    #"Promoted Headers"

     

     

5 Replies

  • The data is actually embedded in a javascript script, so you need to extract that part and then interpret as rows.

     

    let
    Source = Web.BrowserContents("https://e.infogram.com/81277d3a-5813-46f7-a270-79d1768a70b2"),
    d = Text.PositionOf(Source,"data"":[[["),
    e = Text.PositionOf(Source,"]]]"),
    j = Table.FromRows(Json.Document(Text.Range(Source,d+7,e-d-5))),
    #"Promoted Headers" = Table.PromoteHeaders(j, [PromoteAllScalars=true])
    in
    #"Promoted Headers"

     

     

    • reynaldo_malave's avatar
      reynaldo_malave
      Helper III

      lbendlin sorry to write you again. But now I  cant find the table within the source. I mean data[[[]]] is empty. It worked fine when I first load it but then it asked me for a security check up (public, anonimous, etc..) for connecting to the website and now source is just plain empty. Any ideas?

  • lbendlin  Thanks this one was far beyond my skillset. Any documentation I can read to get a hold of what you just did with variable j.

     

    Once again thank you

  • you are right, the format of the HTML has changed.  The data is now in <table class="igc-table __fixed __dynamic"> and it looks like the entire HTML page is generated on the fly. Use a web traffic monitor to see if you can intercept or emulate the download button.

     

    Or - ask the data source owner if they can provide a user friendly API.