Fetch Google Sheets data with Excel Power Query

0

1

I am using Excel 2103 and Excel power query.

The fetch data from web works fantastically on most websites, however I cannot get it to work on Google Sheets

I have tried using the share URL as well as the download to Excel and Download to CSV links and the query returns no data.

Grant

Posted 2015-08-27T12:40:36.400

Reputation: 1

Answers

0

I was able to get this working on some data published by the Gapminder site as Google sheets. I just started from the PQ ribbon, "From Web" button, and pasted in the URL:

http://spreadsheets.google.com/pub?key=0AkBd6lyS3EmpdFhPbDdCTTYxM1dGc21UdE9sSkp1WEE&output=xls

On the Navigator page I chose Data.

Looking at the generated code, it seems PQ is smart enough to wrap an Excel function around the Web function.

let
    Source = Excel.Workbook(Web.Contents("http://spreadsheets.google.com/pub?key=0AkBd6lyS3EmpdFhPbDdCTTYxM1dGc21UdE9sSkp1WEE&output=xls"), null, true),
    Data_Sheet = Source{[Item="Data",Kind="Sheet"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data_Sheet,{{"Column1", type text}, {"Column2", type number}, {"Column3", type number}, {"Column4", type number}, {"Column5", type number}, {"Column6", type number}, {"Column7", type number}, {"Column8", type number}, {"Column9", type number}, {"Column10", type number}, {"Column11", type number}, {"Column12", type number}, {"Column13", type number}, {"Column14", type number}, {"Column15", type number}, {"Column16", type number}, {"Column17", type number}, {"Column18", type number}, {"Column19", type number}, {"Column20", type number}, {"Column21", type number}, {"Column22", type number}, {"Column23", type number}, {"Column24", type number}, {"Column25", type number}, {"Column26", type number}, {"Column27", type number}, {"Column28", type number}, {"Column29", type number}, {"Column30", type number}, {"Column31", type number}, {"Column32", type number}, {"Column33", type number}, {"Column34", type number}, {"Column35", type number}, {"Column36", type number}, {"Column37", type number}, {"Column38", type number}, {"Column39", type number}, {"Column40", type number}, {"Column41", type number}, {"Column42", type number}, {"Column43", type number}, {"Column44", type number}, {"Column45", type number}, {"Column46", type number}, {"Column47", type number}, {"Column48", type number}, {"Column49", type number}, {"Column50", type number}, {"Column51", type number}, {"Column52", type number}})
in
    #"Changed Type"

Mike Honey

Posted 2015-08-27T12:40:36.400

Reputation: 2 119

To use this on your own Google Sheets file, go to File / Publish to Web. Then change the selection from Web Page to Microsoft Excel. Copy the generated link. – Mike Honey – 2016-07-26T07:05:37.507