Excel Web查询:用另一张表格中的值替换查询URL

huangapple go评论55阅读模式
英文:

Excel Web Query: Replace query URL with value from another table

问题

目前,这个多彩的表格正在使用固定的URL。我想要发送一个用户定义的完整URL字符串到这个网络查询,并且每当它更改时都希望它更新。

这个大白色框是一个下拉列表(AN358):

用户可以选择一个新的位置:

这将显示一个新的URL(AN362),指向不同的网络表格(格式始终相同)。在我的情况下,由于它目前是一个固定链接,所以多彩的表格不会改变。

在右边,我将蓝色单元格转换为一个名为“TableYear1”的新表格(AN361):

在Power Editor中,这是现有的查询“Year 1”:

在高级编辑器中,我尝试替换这里突出显示的Web链接:

用这里下划线的值。我知道语法/用法可能是错误的...这只是为了说明我想要实现的目标。

英文:

Currently, the colorful table is using a fixed URL. I want to send a user-defined, complete URL string to this web query, and have it update whenever it's changed.

The large white box is a pulldown list (AN358):

Excel Web查询:用另一张表格中的值替换查询URL

User can choose a new location:

Excel Web查询:用另一张表格中的值替换查询URL

Which brings up a new URL (AN362) which points to a different web table (always same format). In my case, the colorful table does not change since it's currently a fixed link.

To the right, I converted the blue cells into a new table called "TableYear1" (AN361):

Excel Web查询:用另一张表格中的值替换查询URL

In power editor, here is the existing query "Year 1":

Excel Web查询:用另一张表格中的值替换查询URL

In advanced editor, I tried to replace the web link highlighted here:

Excel Web查询:用另一张表格中的值替换查询URL

With the underlined value here. I know the syntax/usage is probably wrong...it's just to illustrate what I want to accomplish.

Excel Web查询:用另一张表格中的值替换查询URL

答案1

得分: 1

尝试使用以下代码替换:

    Source = Web.Page(Web.Contents(Excel.CurrentWorkbook(){[Name="TableYear1"]}[Content]{0}[URL1])),

在你的示例中,你传递了一个字符串(表名),但你需要一个对该表的引用。

英文:

try replacing the code with this

Source = Web.Page(Web.Contents(Excel.CurrentWorkbook(){[Name="TableYear1"]}[Content]{0}[URL1])),

in your example you pass a string (table name), while you need a reference to that table

huangapple
  • 本文由 发表于 2020年1月3日 16:22:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定