在excel power查询中使用带有参数的OData提要

时间:2021-03-21 20:57:01

I am working with power query in excel and need to get some data from an OData feed. Everything works great for the feed actions that do not require parameters, but how can i use an OData feed and pass a parameter to it ?

我正在使用excel中的power query,需要从OData提要获取一些数据。对于不需要参数的提要操作来说,一切都很好,但是如何使用OData提要并将参数传递给它呢?

Example :

例子:

http://url/odata/employees('00090')

http://url/odata/employees(“00090”)

The above throws an error in power query but works fine from a web browser

上面的代码在power查询中抛出一个错误,但是在web浏览器中运行良好

Thanks

谢谢

1 个解决方案

#1


1  

Pasting http://url/odata/employees('00090') into Power Query should probably work if it works in the browser. If you could send-a-frown from the error, we might be able to fix a bug? :)

如果在浏览器中运行的话,将http://url/odata/employees(“00090”)粘贴到Power查询中应该是可行的。如果你能对这个错误皱眉,我们也许能修复一个错误?:)


The more canonical way to pass parameters to OData is trim your URL to the OData Service Document, probably http://url/odata and paste that into Power Query.

将参数传递给OData的更规范的方法是将URL修剪到OData服务文档(可能是http://url/odata),并将其粘贴到Power Query中。

Then you can right click on a cell in the column that's supposed to be 90000, and add a filter for Equals. (If none of the first rows are 90000, filter on e.g. 3 then edit the formula from = 3 to = 90000)

然后,你可以右键单击列中的一个单元格,该单元格应该是90000,然后为Equals添加一个过滤器。(如果第一行中没有一行是90000,请用例3进行筛选,然后编辑公式从= 3到= 90000)

Your formula would looks something like:

你的公式是这样的:

let
    Source = OData.Feed("http://url/odata"),
    #"Filtered Rows" = Table.SelectRows(Source, each [ID] = 90000)
in
    #"Filtered Rows"

#1


1  

Pasting http://url/odata/employees('00090') into Power Query should probably work if it works in the browser. If you could send-a-frown from the error, we might be able to fix a bug? :)

如果在浏览器中运行的话,将http://url/odata/employees(“00090”)粘贴到Power查询中应该是可行的。如果你能对这个错误皱眉,我们也许能修复一个错误?:)


The more canonical way to pass parameters to OData is trim your URL to the OData Service Document, probably http://url/odata and paste that into Power Query.

将参数传递给OData的更规范的方法是将URL修剪到OData服务文档(可能是http://url/odata),并将其粘贴到Power Query中。

Then you can right click on a cell in the column that's supposed to be 90000, and add a filter for Equals. (If none of the first rows are 90000, filter on e.g. 3 then edit the formula from = 3 to = 90000)

然后,你可以右键单击列中的一个单元格,该单元格应该是90000,然后为Equals添加一个过滤器。(如果第一行中没有一行是90000,请用例3进行筛选,然后编辑公式从= 3到= 90000)

Your formula would looks something like:

你的公式是这样的:

let
    Source = OData.Feed("http://url/odata"),
    #"Filtered Rows" = Table.SelectRows(Source, each [ID] = 90000)
in
    #"Filtered Rows"