> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketsflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Sheets sync

> Every sale and every new customer, added to a Google Sheet automatically. Share it with your accountant and stop exporting.

Connect a Google account once and Pocketsflow keeps a spreadsheet up to date
for you: a **Sales** tab with one row per order and a **Customers** tab with
one row per new buyer. New rows arrive within a few minutes of each sale.

<Note>
  Google Sheets sync is part of the **Pro** plan and above.
</Note>

## Set it up

<Steps>
  <Step title="Connect Google">
    Go to **Sales → Google Sheets** and press **Connect Google**. Pick the
    Google account that should own the spreadsheet.
  </Step>

  <Step title="Create the spreadsheet">
    Name it (Pocketsflow sales by default) and choose whether to also add
    past sales: none, or the last 7, 30, 90 or 365 days.
  </Step>

  <Step title="Share it">
    The spreadsheet lives in your Google Drive. Share it with your accountant
    from Google Sheets, like any other file.
  </Step>
</Steps>

## What Pocketsflow can see

Pocketsflow asks Google for one permission, `drive.file`: it can create
spreadsheets and edit the ones it created. It cannot open anything else in
your Drive. That is also why **Use a spreadsheet Pocketsflow made** only
accepts a spreadsheet Pocketsflow created before (for example after you
disconnected and connected again).

Your Google tokens are encrypted at rest and never returned by the API.

## The columns

**Sales**: date (UTC), order ID, product, type (one-time, subscription,
renewal, usage), buyer email, buyer name, country, amount, tax, platform fee,
net, currency and status (paid, refunded, disputed). Money is written as
numbers, so you can sum a column.

**Customers**: first purchase (UTC), email, name, country, first order ID and
first product. One row per email, the first time we see it.

Test-mode sales are never synced.

## How syncing works

* **Every sale once.** Each sale is written once per spreadsheet, however
  often the sync runs or you add past sales.
* **In batches.** Rows go out together, one write per tab, every 2 minutes.
  **Sync now** runs it right away (once a minute).
* **Retries.** If Google refuses a batch, we try again after 1, 2, 4 … minutes
  (up to 6 hours apart). After 8 attempts a row shows as **Failed**; press
  **Retry** to queue it again.
* **Past sales** are added at the bottom of the sheet; sales already there are
  skipped.
* **Turning a tab off** stops new rows. Rows already written stay.

## Disconnecting

**Disconnect Google** stops the sync, revokes Pocketsflow's access and deletes
the stored tokens. The spreadsheet stays in your Drive.

If you remove Pocketsflow's access from your Google account, or delete the
spreadsheet, syncing pauses and the page asks you to connect again. Nothing is
lost: rows waiting to be written go out once you reconnect.

If your plan drops below Pro, the connection is kept and syncing pauses until
you upgrade again.

## API and AI agents

`GET /sheets-sync` shows the connection and its counts. Writes
(`POST /sheets-sync/connect`, `PUT /sheets-sync/spreadsheet`,
`PATCH /sheets-sync`, `POST /sheets-sync/backfill`, `POST /sheets-sync/sync`,
`POST /sheets-sync/retry`) need the Pro plan and answer `403 FEATURE_LOCKED`
below it. Connecting needs a browser: `POST /sheets-sync/connect` returns
Google's consent link for the creator to open. See the
[endpoint reference](/api-reference/endpoints#google-sheets-sync).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.