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.
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
url: the address, such as"https://api.example.com/v1/invoices". Use the base address and put the rest in the options.optional options: a record. Its useful keys areQuery(a record of name and value pairs added to the address, such as[status = "open"]),Headers(a record of HTTP headers),RelativePath(a path added after the base URL),Timeout(how long to wait) andManualStatusHandling(how to treat error responses).
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
- Put parameters in the options record, not in the address string, so they can be changed in one place.
- Sign-in depends on the service: anonymous, an API key in a header, or an account login. Power Query asks the first time and keeps the choice per site.
- A web source has its own privacy level. Combining it with a private file may be blocked until the levels are set.
- Services limit how often you can call them. A refresh that calls the API per row can hit the limit quickly.
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.