OData.Feed

Accessing Data

Returns a navigation table from an OData service at the specified URI.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

OData.Feed(serviceUri as text, optional headers as nullable record, optional options as any) as any

Parameters

NameTypeRequiredDescription
serviceUritextYesThe URI of the OData service root (e.g., "https://services.odata.org/V4/Northwind/Northwind.svc/") or a specific entity set (e.g., "https://api.example.com/odata/Orders").
headersrecordNoAn optional record of HTTP headers to include with each request (e.g., [Authorization = "Bearer token"]).
optionsanyNoAn optional record with additional options such as Query (record of query string parameters), ExcludedFromCacheKey, ODataVersion, Implementation, IncludeAnnotations, Timeout, and MaxUriLength.

Return Value

anyA navigation table of entity sets from the OData service, or a table of records if a specific entity set URI is provided.

Remarks

OData.Feed connects to an OData v3 or v4 service and returns either a navigation table of entity sets (when given the service root URI) or a table of records (when given a specific entity set URI). OData (Open Data Protocol) is a standardized REST protocol built on HTTP and JSON/Atom, widely used in Microsoft services including Dynamics 365, SharePoint, Azure DevOps Analytics, and Dataverse.

Authentication: Supports Anonymous, Basic, Windows, OAuth 2.0, and API key authentication. Configure the appropriate authentication type in the Power Query data source credentials dialog — do not embed tokens or passwords in the M query. For services that use OAuth (e.g., Dynamics 365, Dataverse), Power BI Desktop handles the OAuth flow interactively.

Query folding: OData.Feed has strong query folding support. Filter, sort, column selection, top/skip, and aggregation operations written in Power Query are translated into OData system query options ($filter, $orderby, $select, $top, $skip, $count) and pushed to the server. This significantly reduces data transferred over the network and enables efficient access to large entity sets.

OData version detection: The function reads the service metadata document ($metadata) to auto-detect the OData protocol version. You can override this with [ODataVersion = 4] in the options record. When working with OData v4 services, setting [Implementation = "2.0"] enables a newer connector implementation that may improve compatibility and performance.

Key options (passed as the third options argument): - Query (record) — OData system query options to append to the URI (e.g., [Query = [#"$filter" = "Region eq 'West'", #"$top" = "100"]]). Keys should be quoted with #"" to allow the $ prefix. - ODataVersion (number) — force OData protocol version 3 or 4. - Implementation (text) — set to "2.0" to use the v2 connector implementation for better OData v4 support. - IncludeAnnotations (text) — include OData instance annotations in the result. - Timeout (duration) — maximum time to wait for a response before timing out. - MaxUriLength (number) — override the maximum URI length for requests.

Pagination: OData services using server-driven paging (@odata.nextLink in OData v4, __next in OData v3) are handled automatically — Power Query follows continuation links to retrieve all pages without additional M code.

Examples

Example 1: Connect to a public OData v4 service

```powerquery

OData.Feed("https://services.odata.org/V4/Northwind/Northwind.svc/")

Example 2: Access a specific entity set directly by URI

```powerquery

OData.Feed("https://services.odata.org/V4/Northwind/Northwind.svc/Orders")

Example 3: Navigate to a specific entity set from the service root

```powerquery

let
    Source = OData.Feed("https://myorg.crm.dynamics.com/api/data/v9.2/"),
    Accounts = Source{[Name="accounts"]}[Data]
in
    Accounts

Example 4: Filter using OData query parameters passed in the options record

```powerquery

OData.Feed(
    "https://services.odata.org/V4/Northwind/Northwind.svc/Orders",
    null,
    [Query = [#"$filter" = "ShipCountry eq 'Germany'", #"$select" = "OrderID,CustomerID,OrderDate"]]
)

Example 5: Use the v2 implementation for an OData v4 service

```powerquery

OData.Feed(
    "https://myorg.crm.dynamics.com/api/data/v9.2/",
    null,
    [Implementation = "2.0"]
)

Example 6: Connect to Azure DevOps Analytics OData and navigate to work items

```powerquery

let
    Source = OData.Feed(
        "https://analytics.dev.azure.com/{organization}/{project}/_odata/v3.0-preview/",
        null,
        [Implementation = "2.0"]
    ),
    WorkItems = Source{[Name="WorkItems"]}[Data]
in
    WorkItems

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks