【问题标题】:Excel Power Query Referencing CellExcel Power Query 引用单元格
【发布时间】:2018-09-28 05:38:09
【问题描述】:

我正在努力连接一个 API URL 以包含一个函数,以便在我命名为“testCell”的单元格中获取一个值。此 API 将从客户的跟踪号中提取详细信息。我只希望这个跟踪号是动态的并引用 Excel 中的特定单元格。我使用了 & & 符号,但它显然不起作用。如果我实际上也输入了带有结束“(引号)的实际跟踪号,则查询将完美运行。

查询是:

let
    Source = Json.Document(Web.Contents("https://api.*****.com/api/track?tracking_number=" **&** Excel.Workbook(File.Contents(GetValue("testCell"))), [Headers=[#"Key1"="*****", #"Key2"=****"]])),
    #"Converted to Table" = Record.ToTable(Source),
    Value = #"Converted to Table"{0}[Value],
    #"Converted to Table1" = Record.ToTable(Value)

in

   #"Converted to Table1"

查询结束

我在下面添加了一张图片,也显示了错误消息

Click here for image to the error

我还创建了一个 GetValue 函数:

 (rangeName) => 
    Excel.CurrentWorkbook(){[Name=rangeName]}[Content]{0}[Column1]

有人可以帮忙吗?

【问题讨论】:

    标签: excel concatenation powerquery


    【解决方案1】:

    错误是因为您尝试使用测试单元格中的字符串来加载 Excel 文件,这听起来不像您正在尝试做的事情。删除“Excel.Workbook(File.Contents())”,它应该可以正常工作。

    let
        Source = Json.Document(Web.Contents("https://api.*****.com/api/track?tracking_number=" & GetValue("testCell"), [Headers=[#"Key1"="*****", #"Key2"=****"]])),
        #"Converted to Table" = Record.ToTable(Source),
        Value = #"Converted to Table"{0}[Value],
        #"Converted to Table1" = Record.ToTable(Value)
    
    in
    
       #"Converted to Table1"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-06
      • 1970-01-01
      相关资源
      最近更新 更多