繁体   English   中英

Excel Power Query引用单元格

[英]Excel Power Query Referencing Cell

我正在努力将一个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"

查询结束

我在下面提供了一张图片,还显示了错误消息

点击这里查看错误图片

我还创建了一个GetValue函数:

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

有人可以帮忙吗?

该错误是因为您正在尝试使用测试单元中的字符串来加载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"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM