Paginação
O Sheet Best oferece duas formas de paginar linhas: os parâmetros de consulta _limit e _offset, ou sufixos curtos na URL para uma linha ou um intervalo.
_limit e _offset
| Parâmetro | Descrição |
|---|---|
_limit | Número máximo de linhas retornadas |
_offset | Número de linhas ignoradas antes de ler a planilha |
- 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},
)
Uma linha pelo índice
Acrescente /<Row Index> para buscar uma linha. Os índices começam em 0.
# First row
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/0'
# Third row
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2'
Isso equivale a ?_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
Um intervalo pelo índice
Use /<Start>:<End> para retornar um intervalo de linhas.
# Rows 3 and 4 (0-indexed)
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2:4'
Formas equivalentes:
https://api.sheetbest.com/sheets/YOUR_SHEET_ID/2:4https://api.sheetbest.com/sheets/YOUR_SHEET_ID?_limit=2&_offset=2
Combinar com filtros e consultas
Você pode combinar _limit e _offset com filtros e consultas.
# 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'