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:

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:

StyleHow you ask for the next pageWhen it's doneExample
Page numberspage=2, page=3A page comes back empty or shortMany older APIs
Offset and limitoffset=100&limit=100Offset passes the totalActiveCampaign
CursorSend back the next_cursor from the last responseNo cursor in the responseNotion, Todoist
Next-page link in the bodyRequest the next address the response givesNo nextMany REST APIs
Link headerRequest the address in the response's Link: <...>; rel="next" headerNo rel="next"GitHub, Shopify's REST API
After the last IDstarting_after=<id of the last record>has_more is falseStripe

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

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:

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.

Pagination by app
AppDataHow it pagesPage sizeMost rows per run
GitHubIssuesA next-page link in the Link header100 rows3,000 rows
GitHubPull requestsA next-page link in the Link header100 rows3,000 rows
StripeCustomersContinuing from the last record's id100 rows5,000 rows
StripePayments (charges)Continuing from the last record's id100 rows6,000 rows
StripeBalance (fees and net)Continuing from the last record's id100 rows10,000 rows
StripePayoutsContinuing from the last record's id100 rows2,000 rows
StripeSubscriptionsContinuing from the last record's id100 rows5,000 rows
StripeInvoicesContinuing from the last record's id100 rows6,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. 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.

All guides

Install Cellfetch

From inside a sheet: Extensions > Add-ons > Get add-ons, search Cellfetch, Install. Then Extensions > Cellfetch > Start.