# API Pagination in Google Sheets

Why an API import stops at 100 rows, the common ways apps split long lists into pages, and how to get every row into the sheet on each refresh.

By Jake Marsh. Updated Nov 29, 2026.

## Why the import stops at 100 rows

An API almost never sends a whole list at once. It sends a page, plus a way to ask for the next one, and leaves it to you to keep asking. The page size is usually small and fixed by the app:

- **Stripe** lists return 10 objects unless you ask for more, and at most 100 (`limit` between 1 and 100).
- **Notion** list endpoints return up to 100 items per response (`page_size` from 1 to 100).
- **GitHub** allows at most 100 per page on most endpoints, and if you ask for more it lowers the number without telling you.

So a script that makes one request gets the first page and stops. The sheet shows exactly 10 or 100 rows, which is the tell. Ask for the biggest page the app allows, then follow pages until the app says there are no more.

## The six ways apps split a list into pages

Every API uses one of these, and its docs say which:

| Style | How you ask for the next page | When it's done | Example |
|---|---|---|---|
| Page numbers | `page=2`, `page=3` | A page comes back empty or short | Many older APIs |
| Offset and limit | `offset=100&limit=100` | Offset passes the total | ActiveCampaign |
| Cursor | Send back the `next_cursor` from the last response | No cursor in the response | Notion, Todoist |
| Next-page link in the body | Request the `next` address the response gives | No `next` | Many REST APIs |
| Link header | Request the address in the response's `Link: <...>; rel="next"` header | No `rel="next"` | GitHub, Shopify's REST API |
| After the last ID | `starting_after=<id of the last record>` | `has_more` is false | Stripe |

The Link header style is defined by a web standard, RFC 8288, which is why the same parsing code works on GitHub and on Shopify's REST API. (Shopify's newer GraphQL API pages with a cursor instead.)

## The pitfalls that lose or repeat rows

- **Records added during the run.** With page numbers or offsets, a record created between page 1 and page 2 pushes everything down by one, so one record is read twice and, at the boundary, one can be missed. Cursors and after-the-last-ID styles don't have this problem, which is why apps move to them.
- **Cursors expire.** monday.com's cursors stop working 60 minutes after the first request, so a long run has to finish inside the hour or start again from the first page.
- **Newest first.** Stripe lists the newest records first. If your sheet appends new rows on each run instead of replacing them, match rows by ID so a record that's already there is updated, not added twice.
- **Search endpoints have their own ceiling.** HubSpot's search stops at 10,000 results per query, however you page. Full pulls use the list endpoints, or split the search by date.
- **Rate limits.** Fetching 30 pages in a few seconds can trip the app's limit. When it answers `429 Too Many Requests`, RFC 6585 allows a `Retry-After` header saying how long to wait; wait, then ask for the same page again.

## A pagination loop in Apps Script

If you're writing your own script, this is the shape of a cursor loop. It keeps asking until the response has no cursor, waits when told to (a few times at most), and stops at a page cap so a mistake can't run forever:

```js
function fetchAll(url, token) {
  const rows = [];
  let cursor = '';
  let waits = 0;
  for (let page = 0; page < 50; ) {
    const res = UrlFetchApp.fetch(url + (cursor ? '&cursor=' + encodeURIComponent(cursor) : ''), {
      headers: { Authorization: 'Bearer ' + token },
      muteHttpExceptions: true,
    });
    if (res.getResponseCode() === 429 && waits < 5) {
      const h = res.getHeaders();
      const wait = Number(h['Retry-After'] || h['retry-after']) || 5; // seconds; 5 if missing or a date
      Utilities.sleep(Math.min(wait, 60) * 1000);
      waits++;
      continue; // ask for the same page again
    }
    if (res.getResponseCode() !== 200) throw new Error(res.getContentText());
    page++;
    const body = JSON.parse(res.getContentText());
    rows.push(...body.results);
    cursor = body.next_cursor;
    if (!cursor) break;
  }
  return rows;
}
```

Remember the clock: an Apps Script run stops after 6 minutes. At about a second per page, that's a few hundred pages at most, less if the app makes you wait between them. Lists bigger than that need to be split by date or fetched in steps across several runs.

## How Cellfetch follows pages

Every preset already knows its app's style and page size, so you don't set anything. For a request you build yourself, pick the style from the table above and name its parameters; when you paste a cURL command, Cellfetch spots page-number and offset parameters in the address and sets them up. It follows pages up to the request's page cap, waits between pages where an app asks for it, and honors `Retry-After` when an app says slow down.

## How each app pages

How each app splits a long list into pages, and what Cellfetch asks for on every run. Cellfetch follows the pages for you up to the request's page cap, which you can raise in the request's settings when a list outgrows it.

| App | Data | How it pages | Page size | Most rows per run |
| --- | --- | --- | --- | --- |
| GitHub | Issues | A next-page link in the Link header | 100 rows | 3,000 rows |
| GitHub | Pull requests | A next-page link in the Link header | 100 rows | 3,000 rows |
| Stripe | Customers | Continuing from the last record's id | 100 rows | 5,000 rows |
| Stripe | Payments (charges) | Continuing from the last record's id | 100 rows | 6,000 rows |
| Stripe | Balance (fees and net) | Continuing from the last record's id | 100 rows | 10,000 rows |
| Stripe | Payouts | Continuing from the last record's id | 100 rows | 2,000 rows |
| Stripe | Subscriptions | Continuing from the last record's id | 100 rows | 5,000 rows |
| Stripe | Invoices | Continuing from the last record's id | 100 rows | 6,000 rows |

## Worked example: a year of Stripe charges

Say a shop has 2,340 charges in the last year. At Stripe's default of 10 per page, that's 234 requests. At the maximum of 100, it's 24 requests: 23 full pages and one of 40. Same rows, a tenth of the calls, and a tenth of the time spent waiting on Stripe. That's why every preset asks for the biggest page the app allows. (Estimate, based on Stripe's documented limit of 1 to 100 per page.)

Paging is one of the parts that makes a raw API call a usable import; the others are in [how to use an API in Google Sheets](https://cellfetch.greatwork.company/guides/use-an-api-in-google-sheets). The API pagination glossary entry has the short definition (the rest of the glossary covers rate limits, keys and JSONPath), and the Stripe integration page shows this import as a finished sheet.

## Questions

### Why does my API import stop at exactly 100 rows?

Because 100 is the most many APIs return in one response. Stripe's lists return 10 by default and at most 100; Notion's list endpoints default to 100; most GitHub endpoints allow at most 100 per page. The rest are on later pages, and the import has to ask for each one.

### Why did I get fewer rows than the page size I asked for?

Some APIs quietly lower a page size that's too big. GitHub, for example, reduces per_page to the endpoint's maximum without an error, so asking for 500 still gets 100 and the response looks complete. Always follow the next-page pointer rather than counting rows.

### What does 429 Too Many Requests mean?

You sent requests faster than the app allows. The response may include a Retry-After header saying how long to wait. Pause for that long and try the same page again; don't start over.

### Can a formula follow pages?

Not the built-in IMPORT formulas: each fetches one address. Cellfetch's =CELLFETCH() formula can follow up to 10 pages, and a saved request follows as many as its page cap allows.

## More guides

- [How to Use an API in Google Sheets](https://cellfetch.greatwork.company/guides/use-an-api-in-google-sheets)
- [IMPORTDATA, IMPORTXML and IMPORTHTML in Google Sheets](https://cellfetch.greatwork.company/guides/importdata-importxml-importhtml)
- [How to Import XML into Google Sheets](https://cellfetch.greatwork.company/guides/import-xml-into-google-sheets)
- [How to Build a Dashboard in Google Sheets](https://cellfetch.greatwork.company/guides/dashboard-in-google-sheets)

