Weekly Google Ads performance log in Google Sheets

By General Input

Every Monday morning, snapshot last week's Google Ads campaign metrics into a Google Sheets tracker so you have a living week over week log.

Integrations

  • Google Ads
  • Google Sheets

Type

Deterministic Code

Categories

  • Marketing
  • Operations

Build a code workflow that runs on a cron trigger every Monday at 8am in the account's default timezone, and snapshots last week's Google Ads campaign performance into a Google Sheet so we have a living week over week log.

Prompt parameters the user should provide when launching the workflow:

1) googleAdsCustomerId, the 10 digit Google Ads customer id to query. 2) spreadsheetId, the target Google Sheet id. 3) sheetTab, defaulting to 'Weekly Performance', the tab to append rows to. 4) loginCustomerId, optional, for accounts accessed through a manager (MCC) account.

Step 1. Compute the prior ISO week window. Monday 00:00:00 through Sunday 23:59:59 of the week that just ended, in YYYY-MM-DD form. Store the Monday date as weekStart.

Step 2. Call Google Ads Search Stream (Streamed GAQL Query) against the customer id with this GAQL: SELECT campaign.id, campaign.name, campaign.status, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.conversions_value, segments.date FROM campaign WHERE segments.date BETWEEN '<weekStart>' AND '<weekEnd>'. Aggregate the streamed rows by campaign.id, summing impressions, clicks, cost_micros, conversions, and conversions_value across the segments.date rows. Keep the campaign name and status from the first row seen per campaign.

Step 3. For each aggregated campaign, compute: cost = cost_micros / 1,000,000, CTR = clicks / impressions (0 when impressions is 0), CPA = cost / conversions (null when conversions is 0), ROAS = conversions_value / cost (null when cost is 0). Round cost, CPA, and ROAS to 2 decimals and CTR to 4 decimals. Skip campaigns where impressions, clicks, and cost are all zero.

Step 4. Build one row per campaign in this exact column order: [weekStart, campaign_name, campaign_id, campaign_status, impressions, clicks, cost, conversions, conversions_value, ctr, cpa, roas]. Sort by cost descending so the biggest spenders are at the top.

Step 5. Call Google Sheets Append Values on spreadsheetId with range '<sheetTab>!A:L', valueInputOption RAW, insertDataOption INSERT_ROWS, and pass the rows as the values payload. Do not write a header row on every run; assume the sheet already has headers.

Return a small summary at the end with weekStart, weekEnd, number of campaigns written, total cost, and total conversions so the run log is easy to scan. No LLM reasoning is needed anywhere in this workflow, the schema is fixed and the pipeline is deterministic.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads