Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Issue with importing data from web

Hello,

 

I tried to import tables from a web site and it doesn't work. 

So i tried with another website but now i'm just able to see the tables from the first website (which doesn't work). 

The tables never up date, i don't know why. 

 

Can you help me please ? 

6 Replies

  • hokeson's avatar
    hokeson
    Microsoft Employee

    Hello, what is the source url? Is the table in the source well formated?

     

     

    • hokeson's avatar
      hokeson
      Microsoft Employee

      With this code it worked for me without any issues.

       

       

      let
          Source = Web.BrowserContents("https://fr.wikipedia.org/wiki/D%C3%A9mographie_de_la_France"),
          #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(1)"}, {"Column2", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(2)"}, {"Column3", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(3)"}, {"Column4", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(4)"}, {"Column5", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(5)"}, {"Column6", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(6)"}, {"Column7", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(7)"}, {"Column8", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(8)"}, {"Column9", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(9)"}, {"Column10", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(10)"}, {"Column11", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(11)"}, {"Column12", "TABLE.wikitable:nth-child(31) > * > TR > :nth-child(12)"}}, [RowSelector="TABLE.wikitable:nth-child(31) > * > TR"]),
          #"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
          #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"", Int64.Type}, {"Population (1er janvier)", type text}, {"Naissances", type text}, {"Décès", type text}, {"Accroissement naturel", type text}, {"Taux de natalité (pour 1000)", type text}, {"Taux de mortalité (pour 1000)", type text}, {"Accroissement naturel (pour 1000)", type text}, {"Taux de fécondité[Note 1]", type text}, {"Taux de mortalité infantile (pour 1000 naissances)", type text}, {"Espérance de vie (hommes)", type text}, {"Espérance de vie (femmes)", type text}}),
          #"Removed Bottom Rows" = Table.RemoveLastN(#"Changed Type",1)
      in
          #"Removed Bottom Rows"

       

       

      are you using the most recent version of PBI desktop?

      please keep in mind that the page content and structuture may change.

      here is the history of the page

  • Anonymous's avatar
    Anonymous
    Not applicable

    I use the most recent version of power bi desktop. 

     

    I just install it, so i don't know where i can the the code as you send it. 

     

    The problem is not only for the web site. 

    No matter the web site that i try to import, i always have the same table in the navigator. There is no update. 

    May be there is a problem with my settings ? 

  • Anonymous's avatar
    Anonymous
    Not applicable

    I do the same things as the guide but it doesn't work. 

    I click on import data from web, copy/past the url. 

    I tried with a lot of web site but i always have the following tables :

     

     

    I never have other table, so i can take new data.