Paginate, search, and sort Google Sheets data over REST
Learn how to paginate, search, sort, and shape Google Sheets data over REST with GKit SheetsAPI query params - limit, offset, search, search_exact, sort, fields, and format - with real URL examples.
Your spreadsheet is already a queryable API
With SheetsAPI, the first row of each tab defines your JSON field names, and every read endpoint accepts query parameters that let you paginate, filter, sort, and reshape the response - no extra code, no separate database.
Every list request hits the same base shape:
GET https://sheetsapi.gkit.mreshank.com/api/spreadsheets/{userKey}/{sheetName}
The params below stack together, so you can combine pagination, search, and sorting in a single URL. SheetsAPI is currently in beta and free while we test, and CORS is enabled so you can call it straight from the browser.
Paginate with limit and offset
Use limit to cap how many rows come back (the maximum is 1000) and offset to skip rows from the top. Together they give you classic page-by-page navigation.
# Page 1: first 50 rows
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?limit=50&offset=0"
# Page 2: next 50 rows
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?limit=50&offset=50"To fetch a single row directly instead of paging, hit the row endpoint with a 1-based index:
GET /api/spreadsheets/abc123/Contacts/3
Search with substring and exact matching
The search param filters rows by field:value. Matching is a case-insensitive substring against the named column, so search=name:an matches both "Ana" and "Daniel".
# Case-insensitive substring match on the "name" column
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?search=name:an"When you need an exact match instead of a substring, use search_exact:
# Only rows where status is exactly "active"
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?search_exact=status:active"Search composes with pagination, so you can filter and page at the same time:
GET /api/spreadsheets/abc123/Contacts?search=city:london&limit=20&offset=0
Sort ascending or descending
The sort param orders results by a field. Prefix the field name with - for descending order.
# Ascending by name
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?sort=name"
# Descending by createdAt
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?sort=-createdAt"A common pattern is "newest first, one page at a time" - combine a descending sort with limit and offset:
GET /api/spreadsheets/abc123/Orders?sort=-createdAt&limit=25&offset=0
Shape the response with fields and format
Pick only the columns you need
The fields param takes a comma-separated list of column names and returns only those keys. This trims payloads when your sheet has many columns but your view needs a few.
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?fields=name,email"Choose an output format
By default responses come back as json. The format param also supports csv, tsv, xml, and jsonp. For jsonp, pass a callback name to wrap the response in a function call.
# CSV export of selected fields
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?fields=name,email&format=csv"
# JSONP for a legacy front end
curl "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts?format=jsonp&callback=handleData"Putting it together in JavaScript
Because CORS is enabled, you can build a paginated, searchable, sorted view entirely client-side:
const base = "https://sheetsapi.gkit.mreshank.com/api/spreadsheets/abc123/Contacts";
const params = new URLSearchParams({
search: "city:london",
sort: "-createdAt",
fields: "name,email,createdAt",
limit: "25",
offset: "0",
});
const res = await fetch(`${base}?${params}`);
const rows = await res.json();
console.log(rows);Your endpoints are public until you create an API key. Once you do, send it on every request as Authorization: Bearer sk_... - see the authentication guide for how keys and Google OAuth work.
For the complete parameter list and response details, read the REST API reference. When you're ready to point these queries at your own sheet, sign in with Google to get started.