Skip to Content
Docs

Destinations to Google Sheets

Write your conversions, payouts and programs to a Google Sheet with a destination.

The type google_sheets writes the data of your workspace to a Google Sheet. It keeps one row for each conversion, payout and program. You need an API key with the scope destinations:write and a Google service account. Read the common rules for all types (events, filters, delivery, retries and backfill) in Destinations.

Make the destination

  1. Make a Google service account. Download its JSON key.
  2. Share the spreadsheet with the client_email of the service account. Give it the role Editor.
  3. Make the destination:
curl -X POST https://api.afffast.com/v1/destinations \
  -H "Authorization: Bearer $AFFFAST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "google_sheets",
    "label": "Conversions sheet",
    "config": { "spreadsheet_id": "1AbC..." },
    "credentials": { "service_account_json": "{ ... }" }
  }'
FieldKindMeaning
spreadsheet_idSettingThe ID in the URL of the sheet (docs.google.com/spreadsheets/d/<ID>/edit). The full URL also works. It is required.
sheet_nameSettingThe tab for conversions. The default is Conversions.
payouts_sheet_nameSettingThe tab for payouts. The default is Payouts.
programs_sheet_nameSettingThe tab for programs. The default is Programs.
events_sheet_nameSettingThe tab for other events. The default is Events.
service_account_jsonCredentialThe JSON key of the service account. The API never returns it.

The GET /v1/destination_types response is the source of truth. It has the description and the options of each field.

Tabs

Each kind of data goes to its own tab. Column A of a tab is the key of the row.

KindTab
ConversionsConversions (sheet_name). Key: column A.
PayoutsPayouts (payouts_sheet_name). Key: column A.
ProgramsPrograms (programs_sheet_name). Key: column A.
ClicksNot available.
Other eventsEvents (events_sheet_name).
  • The sheet keeps one row for each conversion, payout and program. Column A is the ID of the object. A change updates the row. A new object adds a row.
  • The tabs must have different names. The service account makes a missing tab.
  • A payout goes to its tab when the destination selects payout.created or payout.updated. A program goes to its tab when the destination selects program.status_changed or commission.changed.

Backfill

A Google Sheets destination takes backfills of conversions, payouts and programs. It does not take clicks. A Google Sheet holds 10 million cells at most, so a click backfill returns 422 with the reason. To keep clicks, use a BigQuery destination. See the backfill rules.

Delivery

Google Sheets is a data_sync type. A temporary error is tried again on the schedule in Delivery. A permanent error (for example a deleted spreadsheet or a bad credential) sets the status failed at once.

On this page