Excel PowerQuery-使用超过260个字符的单元格引用错误

时间:2018-12-10 15:45:35

标签: excel powerquery

我正在尝试使用Excel PowerQuery使用工作簿中的单元格从网页中提取数据以生成URL。该URL被串联,因为该ID来自另一个来源,当前长度为1043个字符。

我正在使用this previous question的答案来执行将单元格值输入查询的任务,但是由于它超过260个字符,所以我收到错误消息。

有没有办法解决这个错误?

let
    Source = Excel.Workbook(File.Contents(GetValue("SourceFile"))),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Name", "Item", "Kind", "Hidden"}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17", "Column18", "Column19", "Column20", "Column21", "Column22", "Column23", "Column24"}, {"Data.Column1", "Data.Column2", "Data.Column3", "Data.Column4", "Data.Column5", "Data.Column6", "Data.Column7", "Data.Column8", "Data.Column9", "Data.Column10", "Data.Column11", "Data.Column12", "Data.Column13", "Data.Column14", "Data.Column15", "Data.Column16", "Data.Column17", "Data.Column18", "Data.Column19", "Data.Column20", "Data.Column21", "Data.Column22", "Data.Column23", "Data.Column24"}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Project ID", Int64.Type}, {"Project Name", type text}, {"Project Action Status", type text}, {"ID", Int64.Type}, {"Title", type text}, {"Owner", type text}, {"Start date", Int64.Type}, {"Due date", Int64.Type}, {"Actual start date", Int64.Type}, {"Actual end date", Int64.Type}, {"Planned working time", type number}, {"Tracked working time", type number}, {"State", type text}, {"Is overdue?", type logical}, {"Milestone", type text}, {"Project group", type text}, {"Files", Int64.Type}, {"Tags", type any}, {"Predecessor tasks", type any}, {"Successor tasks", type any}, {"Last updated at", type number}, {"Last updated by", type text}, {"Description", type text}, {"Last correspondence", type text}})
in
    #"Changed Type"

2 个答案:

答案 0 :(得分:0)

File.Contents的字符限制可能与Windows中的文件路径限制有关。由于您是从网站获取数据,因此请尝试使用Web.Contents而不是File.Contents。

答案 1 :(得分:0)

我使用以下解决方案找到了问题here的答案:

let
    MyURL = Excel.CurrentWorkbook(){[Name="PQLink"]}[Content][Column1]{0},
    Source = Excel.Workbook(Web.Contents(MyURL)),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Name", "Item", "Kind", "Hidden"}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17", "Column18", "Column19", "Column20", "Column21", "Column22", "Column23", "Column24"}, {"Data.Column1", "Data.Column2", "Data.Column3", "Data.Column4", "Data.Column5", "Data.Column6", "Data.Column7", "Data.Column8", "Data.Column9", "Data.Column10", "Data.Column11", "Data.Column12", "Data.Column13", "Data.Column14", "Data.Column15", "Data.Column16", "Data.Column17", "Data.Column18", "Data.Column19", "Data.Column20", "Data.Column21", "Data.Column22", "Data.Column23", "Data.Column24"}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Project ID", Int64.Type}, {"Project Name", type text}, {"Project Action Status", type text}, {"ID", Int64.Type}, {"Title", type text}, {"Owner", type text}, {"Start date", Int64.Type}, {"Due date", Int64.Type}, {"Actual start date", Int64.Type}, {"Actual end date", Int64.Type}, {"Planned working time", type number}, {"Tracked working time", type number}, {"State", type text}, {"Is overdue?", type logical}, {"Milestone", type text}, {"Project group", type text}, {"Files", Int64.Type}, {"Tags", type any}, {"Predecessor tasks", type any}, {"Successor tasks", type any}, {"Last updated at", type number}, {"Last updated by", type text}, {"Description", type text}, {"Last correspondence", type text}})
in
    #"Changed Type"