Google Sheets Destination
Write records to a Google Sheets spreadsheet (overwrite or append).
YAML Example
destination:
type: google_sheets
spreadsheet_id: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms"
sheet: "Sheet1"
mode: overwrite
credentials_env: GOOGLE_SHEETS_CREDENTIALS
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
type | "google_sheets" | — | Required |
spreadsheet_id | string | — | Google Sheets ID (from the URL) |
sheet | string | "Sheet1" | Sheet tab name |
mode | overwrite|append | overwrite | Write mode |
credentials_path | string | null | null | Path to service account JSON keyfile |
credentials_env | string | null | null | Env var containing keyfile path |
Authentication
- Create a Service Account in Google Cloud
- Download the JSON keyfile
- Share the spreadsheet with the service account email
- Set the env var:
export GOOGLE_SHEETS_CREDENTIALS="/path/to/service-account.json"
Common Patterns
Overwrite (replace all data each run):
mode: overwrite
# clears the sheet and writes fresh data with headers
Append (add new rows):
mode: append
# adds rows after existing data, no header row added
Incremental sync to a specific tab:
sheet: "Daily Report"
mode: append
sync:
mode: incremental
cursor_field: created_at
Notes
- Requires
pip install drt-core[sheets](usesgspread+google-auth) overwriteclears the sheet first, then writes headers + dataappendadds rows without clearing — combine withmode: incrementalto avoid duplicates- Columns are positional. The first batch of a run fixes the column set (the union of every record's keys, in first-seen order); a record missing a column gets an empty cell. A later batch that introduces a column the first batch did not have fails the sync with a
column mismatcherror instead of dropping data. If a source has sparse fields that may first appear late, raisesync.batch_sizeso the first batch sees them. - Google Sheets API has a quota of 300 requests/minute per project
spreadsheet_idis the long string in the spreadsheet URL:https://docs.google.com/spreadsheets/d/{spreadsheet_id}/edit