Pagination
Sheet Best supports two ways to page through rows: the _limit and _offset query parameters, or short URL suffixes for a single row or a range.
_limit and _offset
| Parameter | Description |
|---|---|
_limit | Maximum number of rows returned |
_offset | Number of rows to skip before reading the sheet |
- cURL
- JavaScript
- Python
# Skip the first row, then return the next two
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID?_limit=2&_offset=1'
fetch(
'https://api.sheetbest.com/sheets/YOUR_SHEET_ID?_limit=2&_offset=1'
);
import requests
requests.get(
'https://api.sheetbest.com/sheets/YOUR_SHEET_ID',
params={'_limit': 2, '_offset': 1},
)
Single row by index
Append /<Row Index> to fetch one row. Indexes are 0-based.
# First row
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/0'
# Third row
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2'
This is equivalent to ?_limit=1&_offset=<Row Index>:
https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2https://api.sheetbest.com/sheets/YOUR_SHEET_ID?_limit=1&_offset=2
Range by index
Use /<Start>:<End> to return a range of rows.
# Rows 3 and 4 (0-indexed)
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2:4'
Equivalent forms:
https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2:4https://api.sheetbest.com/sheets/YOUR_SHEET_ID?_limit=2&_offset=2
Combining with filters and queries
_limit and _offset can be combined with filtering and querying.
# First 10 rows where Name contains "Jane"
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/Name/*Jane*?_limit=10'
# Page 2 of a query (rows 10-19)
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Amount=__gt(100)&_limit=10&_offset=10'