Start with a manual export if someone needs to review a one-off result. To refresh a recurring spreadsheet, query GA4 through the Data API and write a validated result through the Google Sheets API. Use a stable row key so a retry updates the same report period. Google's report sharing and export guidance, Sheets API writing guide
Set up the destination
- Export a matching GA4 report or CSV as the initial reference. Record its property, timezone, filters and date range.
- Split the spreadsheet into a raw results tab and a dashboard tab. Use one row per property, completed period and breakdown value. Example columns are
property_id,week_start,channel,sessions,key_events, andfetched_at. - Grant the automation identity read access to GA4 and write access to only the destination spreadsheet. Enable both APIs and store OAuth or service credentials in the workflow credential store.
Schedule and validate the sync
Use an n8n scheduled trigger and HTTP Request node to call runReport. Choose a fixed range and metric definitions and retrieve all pages of the chosen channel breakdown. Inspect response flags and row counts before writing. Keep totals in a separate report when metrics like active users can overlap across breakdown rows. Use a separate error workflow for failures. GA4 reporting basics
Upsert by a stable key such as property_id + week_start + channel. A small job can read keys, map them to row numbers, and write the validated cells with spreadsheets.values.update or batchUpdate. Use RAW for untrusted strings and pass parsed numeric values as numbers. Serialize writes from one worker per sheet and update the visible last-refresh marker only after the writes succeed. Sheets update endpoint, Sheets input modes
Recover cleanly
For quota errors, use bounded backoff. Fix access failures before retrying. If a write times out, reread the affected keys and reconcile the last successful rows. On partial collection or validation failure, keep the last verified dataset and report the failure alongside its date. Avoid inserting a false zero for an unavailable period. Sheets API limits
See the Google Analytics overview, Data API reference guide, downloadable weekly automation, and GA4 automation services.