See llms.txt for all machine-readable content.

Back to Templates

Send weekly client reports from Google Sheets with Gemini and Gmail approvals

Quick overview

This workflow builds weekly client report emails from Google Sheets data, generates a short narrative with Google Gemini, routes the draft through a Gmail approval step, and logs each report’s status back to Google Sheets before sending the final email via Gmail.

How it works

  1. Starts manually (demo) or on a weekly schedule and loads the report configuration such as the Google Sheets spreadsheet ID and sender name.
  2. Reads active clients from a Google Sheets “Clients” tab, calculates each client’s reporting and comparison date ranges, builds a unique report key, and skips clients whose report is already in a terminal status in the “Reports” tab.
  3. Pulls the matching weekly context and current/previous metrics from Google Sheets (“Weekly Context” and “Ads Data”), normalizes the dataset, and validates that required fields and metric consistency checks pass.
  4. Calculates week-over-week KPI changes, compiles verified facts, and uses Google Gemini to draft a short summary which is then validated to ensure it is strict JSON and contains no numbers.
  5. Builds the final HTML email (including a deterministic metrics table), logs the report as PENDING_APPROVAL in the Google Sheets “Reports” tab, and sends a Gmail approval request to the reviewer with a 24-hour decision window.
  6. If approved, logs SENDING, sends the client email via Gmail, verifies the Gmail message ID, and writes a final SENT status to Google Sheets; if rejected or timed out (or data/AI validation fails), it writes REJECTED, APPROVAL_TIMEOUT, or DATA_ERROR without emailing the client.

Setup

  1. Create a Google Sheets workbook with tabs named “Clients”, “Weekly Context”, “Ads Data”, and “Reports”, and ensure the columns used for matching include client_id, period_start, period_end, period_type, and report_key.
  2. Add Google Sheets OAuth2 credentials in n8n and set your spreadsheet ID and sender name in the workflow configuration fields.
  3. Add Google Gemini credentials for the Gemini model used to generate the summary.
  4. Add Gmail OAuth2 credentials for both the reviewer approval email and the outbound client email, and populate each client’s reviewer_email and recipient_email in the “Clients” sheet.
  5. Run the workflow in test/demo mode first with mailboxes you control, then disable test mode and enable the schedule trigger when you are ready for live weekly sending.