DEV Community

SunsetKit
SunsetKit

Posted on Originally published at tallyfeed.netlify.app

Load your whole Gumroad sales history into Google Sheets (not just new sales)

The usual way to get Gumroad sales into a spreadsheet is a Zapier, Make or IFTTT recipe: "new sale → add row". That works for sales that
happen after you switch it on. Your first year of sales never shows up, and a refund a week later doesn't change the row it belongs to.

Gumroad's own API can give you everything since day one. This post shows the ~40 lines of Google Apps Script that do it: page through
GET /v2/sales, write one row per sale, and rewrite the sheet on a daily timer so refunds and chargebacks stay current.

1. Get a Gumroad access token

  1. In Gumroad, open Settings → Advanced → Applications and create an application (name it anything; the redirect URI can be http://localhost because you won't use the OAuth flow).
  2. On the application page, click Generate access token. Copy it.

The sales endpoint needs the view_sales scope. Treat the token like a password: it can read every sale and buyer email on your account.

2. What the API returns

GET https://api.gumroad.com/v2/sales returns up to 100 sales per page, newest first, plus a next_page_key. You pass that back as
page_key until it stops coming. Optional filters: after / before (YYYY-MM-DD), product_id, email, order_id.

The fields most people want in a sheet (amounts are in cents of the sale's currency):

Field Meaning
created_at ISO 8601 timestamp of the sale
product_name, product_id which product
price price paid, in cents
gumroad_fee Gumroad's fee, in cents
currency e.g. usd
quantity units
partially_refunded, chargedback refund / dispute flags
order_id, id identifiers you can join on
referrer, utm_source, utm_campaign where the buyer came from

3. The script

Create a new Google Sheet, then Extensions → Apps Script, and paste this:

const COLUMNS = ['created_at', 'product_name', 'price', 'gumroad_fee', 'net', 'currency', 'quantity',
                 'partially_refunded', 'chargedback', 'referrer', 'utm_source', 'order_id', 'id'];

function importAllSales() {
  const token = PropertiesService.getScriptProperties().getProperty('GUMROAD_TOKEN');
  if (!token) throw new Error('Set the GUMROAD_TOKEN script property first');

  const rows = [];
  let pageKey = null;
  do {
    let url = 'https://api.gumroad.com/v2/sales?access_token=' + encodeURIComponent(token);
    if (pageKey) url += '&page_key=' + encodeURIComponent(pageKey);
    const res = JSON.parse(UrlFetchApp.fetch(url).getContentText());
    if (!res.success) throw new Error('Gumroad API error: ' + JSON.stringify(res).slice(0, 300));

    for (const s of res.sales) {
      rows.push(COLUMNS.map(c => {
        if (c === 'price' || c === 'gumroad_fee') return (s[c] || 0) / 100;
        if (c === 'net') return ((s.price || 0) - (s.gumroad_fee || 0)) / 100;
        if (c === 'created_at') return new Date(s.created_at);
        return s[c] === undefined ? '' : s[c];
      }));
    }
    pageKey = res.next_page_key || null;
  } while (pageKey);

  const ss = SpreadsheetApp.getActive();
  const sheet = ss.getSheetByName('Sales') || ss.insertSheet('Sales');
  sheet.clearContents();
  sheet.getRange(1, 1, 1, COLUMNS.length).setValues([COLUMNS]);
  if (rows.length) sheet.getRange(2, 1, rows.length, COLUMNS.length).setValues(rows);
  sheet.setFrozenRows(1);
}
🔥 ข่าวด่วน: sunsetkit/load your whole gumroad sales history into google sheets not just new sales fh - Kapook Update 2025 🔥 ข่าวด่วน: sunsetkit/load your whole gumroad sales history into google sheets not just new sales fh - Kapook Update 2025

Then:

  1. Project Settings → Script properties → Add: name GUMROAD_TOKEN, value = your token. (Keeping it out of the code means you can share the sheet without leaking it.)
  2. Select importAllSales and click Run. Google asks you to authorise the script for your own account (it needs the sheet and "connect to an external service").
  3. Triggers (clock icon) → Add trigger → importAllSales, time-driven, day timer. Now the sheet rebuilds itself every night.

Rewriting the whole sheet each time is deliberate: a sale that was refunded or charged back last week gets its new flags instead of
leaving a stale row behind. It also means you shouldn't type into the Sales tab. Build your summaries on a second tab instead.

4. A monthly summary tab

On a new tab, one formula gives revenue and net by month:

=QUERY(Sales!A:E, "select year(A), month(A)+1, sum(C), sum(E) where A is not null group by year(A), month(A)+1 label year(A) 'Year', month(A)+1 'Month', sum(C) 'Gross', sum(E) 'Net'", 1)
🔥 ข่าวด่วน: sunsetkit/load your whole gumroad sales history into google sheets not just new sales fh - Kapook Update 2025 🔥 ข่าวด่วน: sunsetkit/load your whole gumroad sales history into google sheets not just new sales fh - Kapook Update 2025

Swap C/E for B and group by product for a per-product table.

Limits worth knowing

  • Currencies: amounts come in the sale's own currency. If you sell in more than one, add a currency filter or convert before summing.
  • Run time: Apps Script stops a run after 6 minutes. That's tens of thousands of sales; past that, fetch with after= in yearly chunks and append instead of rewriting.
  • Fees: gumroad_fee is Gumroad's fee only. Payment-processor and payout fees, VAT and sales tax handling are separate, so "net" here isn't what lands in your bank.

If you'd rather not maintain a script

We're making Tallyfeed, a ready Google Sheets template that does the above plus a dashboard by month, product and country
and a refunds tab. It runs in your own Google account; your token and data never touch our servers. It's in early access
at $19 one-time: https://tallyfeed.netlify.app. Tell us in the comments which tabs you'd want; that decides what ships first.

Tallyfeed is made by the same small team as SunsetKit (Top Focus LLC).

Top comments (0)