Pular para o conteúdo principal

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âmetroDescrição
_limitNúmero máximo de linhas retornadas
_offsetNúmero de linhas ignoradas antes de ler a planilha
# Skip the first row, then return the next two
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID?_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/2
  • https://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:4
  • https://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'