使用 Excel Power Query 获取 Google 表格数据

使用 Excel Power Query 获取 Google 表格数据

我正在使用 Excel 2103 和 Excel power query。

在大多数网站上,从网络获取数据的功能都非常出色,但我无法在 Google 表格上使用它

我尝试使用共享 URL 以及下载到 Excel 和下载到 CSV 链接,但查询没有返回任何数据。

答案1

我能够让此功能处理 Gapminder 网站以 Google 表格形式发布的一些数据。我刚从 PQ 功能区中的“来自 Web”按钮开始,然后粘贴 URL:

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

在导航器页面上,我选择了数据。

查看生成的代码,PQ 似乎足够智能,可以将 Excel 函数包装在 Web 函数周围。

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"

相关内容