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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Yggdrasill
Responsive Resident
Responsive Resident

Google Docs *Community Challenge!*

Hello

 

As you know the corona virus is spreading around. The information are being gathered publicly here

The tables have the same structure for each sheet - which is important !

When I connect to the file using the web connector in PBI Desktop the Navigator pops up with this option

Navigator.PNG

 

There are currently 19 Tables found as there are 19 sheets in the actual document. There will be more sheets to come !

Here is the problem - How can I refresh the data and get all tables at each refresh ?

What I've tried so far is to look at the difference between two table and found out that the sheets have Id's but there's no way of knowing what the Id is. However the power query function Html.Table will create this code for you when you select one table from the navigator

 

    #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(1), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(1)"}, {"Column2", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(2), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(2)"}, {"Column3", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(3), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(3)"}, {"Column4", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(4), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(4)"}, {"Column5", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(5), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(5)"}, {"Column6", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(6), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(6)"}, {"Column7", "DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR > :nth-child(7), DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR > :nth-child(7)"}}, [RowSelector="DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > TR, DIV[id='1368739505'] > DIV.ritz.grid-container:nth-child(1) > TABLE.waffle:nth-child(1) > * > TR"]),
   

 




If I right click on the document it self on google docs and select "Inspect" and then go to console and paste this code there and press Enter (works on Chrome and new Edge browser)


 

var urls=$$('a');for(url in urls){console.log("%c#"+url+" - %c"+urls[url].innerHTML +" -- %c"+urls[url].href,"color:red;","color:green;","color:blue;");}

 

I get this result 


2020-01-30 11_08_27-Presentation3 - PowerPoint.png+

 

As you can see the command lists out the sheet names for me.

I know there's a way to get all the sheet names and probably the Sheet's ID and then query the document for each ID to get ALL tables from the document.

This is do-able if this was an excel file using the function File.Contents() but I'm kinda stuck on how to workaround for this problem. See here

Long story short: I can't get all tables from this file : https://docs.google.com/spreadsheets/d/1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w/htmlview?usp=sha... because there will be added more and more sheets as time passes by.

Can we do this ? 





1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Yggdrasill 

 

You may try to operate as follows.

1. Connect the url :

url 

1.png

 

2. Add a custom column

2.png

 

3. Delete the origin Data column

5.png

3.png

4.png

 

url 

 

Here is the codes in Advanced Editor.

let
    Source = Excel.Workbook(Web.Contents("https://docs.google.com/spreadsheets/d/1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w/export?format=xlsx&id=1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w"), null, true),
    #"Added Custom" = Table.AddColumn(Source, "DataTable", each Table.PromoteHeaders([Data])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
    #"Expanded DataTable" = Table.ExpandTableColumn(#"Removed Columns", "DataTable", {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered", "Suspected", "Demised", "Country", "Date last updated"}, {"DataTable.Province/State", "DataTable.Country/Region", "DataTable.Last Update", "DataTable.Confirmed", "DataTable.Deaths", "DataTable.Recovered", "DataTable.Suspected", "DataTable.Demised", "DataTable.Country", "DataTable.Date last updated"})
in

 

Best Regards

Allan

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Yggdrasill 

 

You may try to operate as follows.

1. Connect the url :

url 

1.png

 

2. Add a custom column

2.png

 

3. Delete the origin Data column

5.png

3.png

4.png

 

url 

 

Here is the codes in Advanced Editor.

let
    Source = Excel.Workbook(Web.Contents("https://docs.google.com/spreadsheets/d/1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w/export?format=xlsx&id=1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w"), null, true),
    #"Added Custom" = Table.AddColumn(Source, "DataTable", each Table.PromoteHeaders([Data])),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
    #"Expanded DataTable" = Table.ExpandTableColumn(#"Removed Columns", "DataTable", {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered", "Suspected", "Demised", "Country", "Date last updated"}, {"DataTable.Province/State", "DataTable.Country/Region", "DataTable.Last Update", "DataTable.Confirmed", "DataTable.Deaths", "DataTable.Recovered", "DataTable.Suspected", "DataTable.Demised", "DataTable.Country", "DataTable.Date last updated"})
in

 

Best Regards

Allan

You absolute beauty !

May I ask, how did you get the final url ?

I knew about the /export?format=xlsx but where did you get this string from ?

 

id=1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w

 

EDIT: Nevermind, I see it now it is what appears after /d/  !

https://docs.google.com/spreadsheets/d/1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w/export?format=xlsx&id=1yZv9w9zRKwrGTaR-YzmAqMefw4wMlaXocejdxZaTs6w

 Thanks again !

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.