<!-- https://learnsql.cpetoday.com/functions/m/odata-feed -->
# OData.Feed

Language: Power Query M
Category: Data sources
Syntax: OData.Feed(serviceUri, optional headers, optional options)
Summary: Connects to an OData service, a web data feed used by many business applications, and returns the tables it publishes.
Returns: A navigation table. Selecting a table from it gives you that feed's rows.
Level: Intermediate
Related: Web.Contents, Json.Document, Sql.Database, Table.SelectRows, Table.SelectColumns

## What it does
OData is a standard for data feeds that many business applications publish. OData.Feed connects to such a feed and lists the entities it offers, such as invoices, customers or ledger entries. You pick one, and its rows load. Where the service supports it, filters and column choices are sent back to the service, so it returns less data.

## Syntax and arguments
- `serviceUri`: the address of the feed, as text.
- `headers` (optional): a record of extra HTTP headers, for services that need them.
- `options` (optional): a record of settings, such as the version of the protocol the service uses.

## Example
An application publishes its open invoices as an OData feed. The query loads the invoice entity and keeps the open, unpaid items.

```powerquery
let
    Source = OData.Feed("https://reports.example.com/odata/"),
    Invoices = Source{[Name = "Invoices"]}[Data],
    Open = Table.SelectRows(Invoices, each [Status] = "Open"),
    Kept = Table.SelectColumns(Open, {"InvoiceNumber", "CustomerName", "Amount", "DueDate"})
in
    Kept
```

The address is a placeholder for a service you have access to. `Source` lists the entities, and the lookup picks Invoices. The filter and column choices may be sent to the service, depending on what it supports.

## Example: a second, different use
Reading one entity with a fixed set of columns, to build a customer list for a receivables review.

## Things to watch
- Names of entities and columns depend on the service. Check them in the navigation list before you write steps.
- Not every OData service supports every filter. Check View Native Query, or the number of rows loaded, to see what the service handled.
- Sign-in depends on the application. It may use an account, a token or an API key.
- Large feeds can be slow. Filter early and select only the columns you need.

## In business terms
Many accounting, billing, payroll and CRM products expose their data this way. Connecting to a feed avoids manual exports and keeps the report current.
