Downloads
Power Query MData sourcesIntermediate

Web.Contents

Fetches the content of a web address (a web page, file or API response) as binary, with optional query parameters, headers and timeout.

Syntax
Web.Contents(url, optional options)

Returns: The response body as binary. Pass it to Json.Document, Csv.Document, Excel.Workbook or Web.Page to read it.

What it does

Web.Contents sends a request to a web address and returns what comes back. The address is the base URL. Query parameters, headers and other settings go in the options record, which keeps the address clean and lets Power Query build the full request. Use it to read a web API, a published CSV or Excel file, or an HTML table on a page.

Syntax and arguments

Example

A web service lists open invoices, filtered by status and date. The query asks for open invoices for March 2026 only, and reads the JSON.

let
    Response = Web.Contents("https://api.example.com/v1/invoices", [
        Query = [status = "open", dueBefore = "2026-04-01"]
    ]),
    Invoices = Json.Document(Response),
    AsTable = Table.FromRecords(Invoices)
in
    AsTable

The filters go in the Query record, so Power Query builds the address with them. The result is one row per invoice. The address example.com is a placeholder; use the service you are licensed to use.

Example: a second, different use

Downloading a published CSV: Csv.Document(Web.Contents("https://example.com/rates.csv")) reads a file that a bank or central bank publishes.

Things to watch

In business terms

Exchange rates, bank data feeds, payment platform reports and public statistics are often read this way. Name the source and the date pulled in the close notes, so the figures can be traced.

Related functions

All Power Query M functions · View as Markdown · M basics