Pagination - Limits and Offsets

Created by Roanne Jane Jane Jaype, Modified on Mon, 1 Aug, 2022 at 3:35 PM by Roanne Jane Jane Jaype

There are two special parameters called _limit and _offset, they allow you to paginate the results from the API.


ParameterDescription
_limitLimits the number of rows returned
_offsetSkips a number of rows before start reading the sheet

Example:

Querying https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf?_limit=2&_offset=1 will skip the first row, and return the next 2 rows.

Shorthand Alternative

If you want to return a single row, you can use the /<Row Index> suffix.

This is similar to using the _limit=1&offset=<Row Index> queryingstring.

Example of equivalent requests:

  • https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf?_limit=1&_offset=2
  • https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/2

You can also use: /<Row Index Start>:<Row Index End> instead of explicitly telling the _limit and _offset.

Example of equivalent requests:



_____________________


    Shell

# Get 2 rows, skipping the first row
curl 'https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf?_limit=2&_offset=1'

# Get the first row
curl 'https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/0'
HTML


       Python

import requests

# Get 2 rows, skipping the first row
requests.get('https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf?_limit=2&_offset=1')

# Get the first row
requests.get('https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/0')
HTML

       Javascript

// Get 2 rows, skipping the first row
fetch(
  "https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf?_limit=2&_offset=1"
);

// Get the first row
fetch("https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/0");

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article