Stop re-reading the whole sheet: a push‑sync design for Google Sheets and n8n
Description and use
Design where Google Sheets pushes edited rows to n8n via webhook, n8n upserts data, eliminating full‑sheet downloads and ensuring sync with nightly reconciliation.
Problem
A cron workflow that reads a Google Sheet on every run pays the same tax every time: the full download.
Outcome
The design eliminates full‑sheet downloads, reduces latency, and maintains data consistency between Google Sheets and n8n.
Workflow
- 1. In Google Sheets, add an Apps Script function onEditPush that POSTs edited row data to an n8n webhook.
- 2. Create an installable trigger (From spreadsheet → On edit) to run the script.
- 3. In n8n, set up a Webhook node to receive POSTs and a Code node to zip values with headers and upsert into workflow static data keyed on appointment_id.
- 4. Handle invalid payloads by logging errors and responding 422.
- 5. Run a nightly job that queries the key column via the gviz/tq endpoint, flattens the result, and reconciles drift with the stored data.
Evidence
A cron workflow that reads a Google Sheet on every run pays the same tax every time: the full download.
The sheet pushes edited rows
The upsert is idempotent. Two rapid edits to the same row fire two POSTs, the second overwrites the first, and that matches the sheet's own last-write-wins editing behavior.
- Record date: 2026-10-22T06:11:05.938Z