Overview
The API speaks CSV. Ask for it withAccept: text/csv and every view and every function answers with a header row and comma-separated values, straight into a spreadsheet.
The catch is headers. A spreadsheet formula like Google Sheets’ IMPORTDATA cannot set any, and without Accept: text/csv the server answers JSON. So the working recipes are the ones that can set a header: Apps Script in Sheets, Power Query in Excel.
Everything under “What the server does” was observed on 2026-09-24 against the
live API with the curl commands shown. The Apps Script and Power Query
snippets were not executed: they are written against those observations,
and are marked as such.
What the server does
Base URL and key are the ones on Quickstart:
A view, as CSV:
POST with a JSON body, or GET with the arguments in the query string; both return the same CSV:
quote_history returns one JSON object per session holding only the fields you select (default ticker, trade_date, close_adj), so as CSV it is a single column of JSON. For a price series in a sheet, read the typed views (equities, units, raw closes) as below, or call quote_history as JSON.Google Sheets: IMPORTDATA does not work
IMPORTDATA(url) fetches a URL and splits it as CSV. It cannot set headers, so:
- the key can go in the URL (
?apikey=…worked, above); - the schema needs no header (
apiis the default); - but the format cannot be chosen, and without
Accept: text/csvthe server returned JSON in every request we made.
text/csv, IMPORTDATA gets JSON and splits it on commas into cells like [{"ticker":"PETR4". We found no way to request CSV from the URL alone, so IMPORTDATA is not a supported recipe.
Google Sheets: Apps Script custom function
Extensions → Apps Script, paste, save:Excel: Power Query
Data → Get Data → From Other Sources → Blank Query → Advanced Editor:Web.Contents sends a POST when Content is set:
"en-US" culture on the type step matters. The server writes decimals with a dot (49.600000), and a workbook in a Brazilian locale reads a dot as a thousands separator. We did not test this in a pt-BR Excel; typing the columns with an explicit culture is the safe default either way.
Key in the URL: the trade-off
It works (?apikey=…, observed above), and it is the only way to authenticate from a tool that cannot set headers. Two honest caveats:
- The key then appears in the sheet, the query, the browser history and any proxy log. It is the shared publishable key, already printed on these docs, so nothing secret leaks. A user token from sign-in is different: never put one in a URL.
- It does not solve the format. A tool that cannot set
Acceptgets JSON, so the URL-key route is useful only to tools that parse JSON.
Related
Conventions & limits
Auth tiers, the 1,000-row cap, nulls.
Paging without losing rows
Three ways a response gets cut, and only one tells you.