JSON, CSV, TSV, XML, and JSONP output from a Google Sheet
GKit SheetsAPI can return your Google Sheet as JSON, CSV, TSV, XML, or JSONP. Learn how the format query param works, see a real request for each, and pick the right format for BI tools, browsers, and legacy cross-origin scripts.
One sheet, five output formats
SheetsAPI turns any Google Sheet into a REST API: the first row of each tab defines your JSON field names, and every other row becomes a record. By default a list request returns JSON, but you rarely want JSON everywhere. A BI tool wants CSV. A spreadsheet import wants TSV. An old SOAP-era system wants XML. A <script> tag on a page you don't control wants JSONP.
Rather than transforming the data yourself, you ask SheetsAPI to emit the shape you need with a single query parameter: format. It accepts json (the default), csv, tsv, xml, and jsonp.
Every example below uses the live base URL https://sheetsapi.gkit.mreshank.com/api and the list endpoint:
GET /api/spreadsheets/{userKey}/{sheetName}
SheetsAPI is currently in beta and free while we test, so you can try all of these today.
JSON (the default)
If you omit format, you get JSON. It is the right choice for almost any modern app, frontend fetch, or backend integration.
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Products?limit=50"You can combine format with the other list parameters. To pull the 50 most recently added in-stock products, sorted descending by a created column and returning only three fields:
const url =
"https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Products" +
"?search=status:in_stock&sort=-created&fields=name,price,created&limit=50";
const res = await fetch(url);
const rows = await res.json();CORS is enabled, so this fetch works straight from the browser. The search=field:value filter is a case-insensitive substring match; add search_exact when you need an exact match instead.
CSV and TSV for spreadsheets and BI
Set format=csv when the consumer is a spreadsheet, a data warehouse loader, or a BI tool like Looker Studio, Power BI, or Tableau that imports from a URL. The first row of the response is the header, derived from your sheet's header row.
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Products?format=csv&fields=name,price,created" \
-o products.csvReach for format=tsv instead when your data contains commas (prices, addresses, free-text notes) that would need quoting in CSV. Tab-separated values paste cleanly into Google Sheets and Excel:
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Products?format=tsv"Because format composes with sort, search, offset, and limit (max 1000 per request), you can hand a colleague a single URL that always returns the exact filtered slice they need as a downloadable file.
XML for legacy and enterprise systems
Some integrations - older ERPs, XSLT pipelines, or services that only speak XML - cannot consume JSON. Use format=xml:
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Products?format=xml&limit=100"Each row maps to an element whose children are named after your header fields, so the structure stays predictable as long as your first row does.
JSONP for legacy cross-origin scripts
CORS already handles modern cross-origin reads, so you usually do not need JSONP. It exists for one case: an old page or widget that loads data via a <script> tag rather than fetch or XMLHttpRequest, often because it must run in an environment without CORS support.
Pass format=jsonp and a callback name. SheetsAPI wraps the JSON payload in a call to that function:
<script>
function renderProducts(rows) {
console.log(rows);
}
</script>
<script src="https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Products?format=jsonp&callback=renderProducts"></script>When the script loads, the browser invokes renderProducts(...) with your sheet data. For any new project, prefer plain JSON over fetch - JSONP is a compatibility tool, not a default.
Choosing a format
A quick rule of thumb:
- JSON - apps, APIs, and browser
fetch. The default for a reason. - CSV - spreadsheet imports and BI tools that read from a URL.
- TSV - the same use, but when your data has commas.
- XML - legacy or enterprise systems that require it.
- JSONP - only for old
<script>-tag cross-origin loads.
The same format param works on the single-row endpoint (/api/spreadsheets/{userKey}/{sheetName}/{row}, 1-based) too. Writes - POST to append, PUT and DELETE to update and remove - are covered in the REST API reference.
While SheetsAPI is in beta your API is public until you create a key. Once you do, send it as Authorization: Bearer sk_...; see authentication for how keys and Google OAuth fit together. Ready to try it on your own sheet? Sign in with Google to get started.