AutomationFlowsAI & RAG › Generate Marketing Campaign Roi Reports with Google Sheets, Gpt-4o and Email

Generate Marketing Campaign Roi Reports with Google Sheets, Gpt-4o and Email

ByRobert Breen @rbreen on n8n.io

This n8n workflow pulls campaign data from Google Sheets, summarizes it using OpenAI, and sends a performance recap via Outlook email. In n8n, go to Credentials → click New Credential Select Google Sheets OAuth2 API Log in with your Google account and authorize Use a spreadsheet…

Event trigger★★★★☆ complexityAI-powered16 nodesOpenAI ChatOutput Parser StructuredGoogle SheetsAgent
AI & RAG Trigger: Event Nodes: 16 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #7586 — we link there as the canonical source.

This workflow follows the Agent → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "df93659a-1341-4042-885c-1624e5501f3f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1792,
        -176
      ],
      "parameters": {
        "width": 540,
        "height": 848,
        "content": "## \ud83d\udcc8 Campaign ROI Report with Generative AI + Email\n\nThis n8n workflow pulls campaign data from Google Sheets, summarizes it using OpenAI, and sends a performance recap via Outlook email.\n\n### \u2705 Step 1: Connect Google Sheets\n\n1. In n8n, go to **Credentials** \u2192 click **New Credential**\n2. Select **Google Sheets OAuth2 API**\n3. Log in with your Google account and authorize\n4. Use a spreadsheet with:\n   - Column names in the first row  \n   - Data in rows 2\u2013100  \n5. Example format: [\ud83d\udcc4 Sample Marketing Sheet](https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit?usp=sharing)\n\n### \u2705 Step 2: Connect OpenAI\n\n1. Go to [OpenAI API Keys](https://platform.openai.com/api-keys)\n2. Make sure you have a payment method set under [Billing](https://platform.openai.com/settings/organization/billing/overview)\n3. In n8n, create a new **OpenAI API** credential\n4. Paste your API key and save\n\n\n### \ud83d\udcec Need Help?\n\nFeel free to contact me if you run into issues:\n\n- \ud83d\udce7 robert@ynteractive.com  \n- \ud83d\udd17 [LinkedIn](https://www.linkedin.com/in/robert-breen-29429625/)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "07bc087a-adc5-4094-8236-bf3c90dfc7db",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1088,
        64
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "07ace160-586f-46b0-8b13-8d7fa467703b",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -224,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9f3326c5-e0c8-48e6-a560-08ee63ada662",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        96,
        272
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"output\": \"Overall, campaign performance was strong this week. Retargeting efforts delivered the highest return, while a few awareness campaigns underperformed in conversions.\\n\\n\u2022 \ud83d\udcc8 'Spring Retargeting' had the highest ROAS at 9.1\\n\u2022 \ud83d\udcb0 'Loyalty Push' generated $12,000 revenue on $1,600 spend\\n\u2022 \ud83d\udcc9 'Awareness Boost - TikTok' had low conversions despite high spend\\n\u2022 \ud83e\udde0 Meta Ads accounted for 70% of total conversions\\n\\nTotals:\\n\u2022 Total Spend: $12,480\\n\u2022 Impressions: 983,400\\n\u2022 Clicks: 23,980\\n\u2022 Conversions: 1,482\\n\u2022 Revenue: $48,000\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "4719e276-755a-4791-9865-d6c12172c0d5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 684,
        "height": 400,
        "content": "### Aggregate and Combine Data"
      },
      "typeVersion": 1
    },
    {
      "id": "84d6aad8-d30f-4c77-a134-476065d8d674",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -176
      ],
      "parameters": {
        "color": 3,
        "width": 672,
        "height": 416,
        "content": "### 2. Prepare Your Google Sheet\n\n#### Connect your Data in Google Sheets\n- Data must be in a format similar to this: [Sample Marketing Data](https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit?gid=365710158#gid=365710158)\n- First row contains column names\n- Data in rows 2-100\n- Log in with OAuth2 and choose your workbook and sheet\n- Optional: Try connecting to Airtable, Notion or your Database"
      },
      "typeVersion": 1
    },
    {
      "id": "135a26ff-151e-494f-a862-c59063285dc4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 828,
        "height": 848,
        "content": "### AI Agent analyzes data and sends daily email"
      },
      "typeVersion": 1
    },
    {
      "id": "4b5211e3-46d3-42f7-ad79-64eff2d30567",
      "name": "Get Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -832,
        64
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 365710158,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit#gid=365710158",
          "cachedResultName": "Data"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - n8n"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5b61292d-8951-4ec2-9274-a9600c5d4d07",
      "name": "Sum Campaigns",
      "type": "n8n-nodes-base.summarize",
      "position": [
        -1168,
        336
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Campaign",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Spend ($)",
              "aggregation": "sum"
            },
            {
              "field": "Clicks",
              "aggregation": "sum"
            },
            {
              "field": "Conversions",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "19ec9e9f-651f-44d2-868e-cd6742376707",
      "name": "Sum Channels",
      "type": "n8n-nodes-base.summarize",
      "position": [
        -1168,
        496
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Channel",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Spend ($)",
              "aggregation": "sum"
            },
            {
              "field": "Clicks",
              "aggregation": "sum"
            },
            {
              "field": "Conversions",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "f7f310bb-457c-4784-922d-3ca31ebcbe02",
      "name": "Combine",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -1024,
        336
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "campaign_performance"
      },
      "typeVersion": 1
    },
    {
      "id": "200c07d6-05c3-4680-a22b-5ec6803c02a7",
      "name": "Combine ",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -1024,
        496
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "channel_performance"
      },
      "typeVersion": 1
    },
    {
      "id": "51d56f0e-6c2e-40c4-ac67-445218b9a78e",
      "name": "Merge Results",
      "type": "n8n-nodes-base.merge",
      "position": [
        -848,
        400
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "7995b9a9-7bc4-4b41-81ac-a33694e42657",
      "name": "Convert to Text",
      "type": "n8n-nodes-base.code",
      "position": [
        -704,
        400
      ],
      "parameters": {
        "jsCode": "const campaignData = items[0].json.campaign_performance || [];\nconst channelData = items[0].json.channel_performance || [];\n\nlet campaignSummary = `\ud83d\udcca Campaign Performance:\\n`;\nfor (const entry of campaignData) {\n  campaignSummary += `\u2022 ${entry.Campaign}: $${entry[\"sum_Spend_($)\"].toFixed(2)} spend, ${entry[\"sum_Clicks\"]} clicks, ${entry[\"sum_Conversions\"]} conversions\\n`;\n}\n\nlet channelSummary = `\\n\ud83d\udce3 Channel Performance:\\n`;\nfor (const entry of channelData) {\n  channelSummary += `\u2022 ${entry.Channel}: $${entry[\"sum_Spend_($)\"].toFixed(2)} spend, ${entry[\"sum_Clicks\"]} clicks, ${entry[\"sum_Conversions\"]} conversions\\n`;\n}\n\nreturn [\n  {\n    json: {\n      output: campaignSummary + channelSummary\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "43390f07-1797-41d7-bee5-40c37f0ff73f",
      "name": "Analyze Marketing Data",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -144,
        0
      ],
      "parameters": {
        "text": "=Data: {{ $json.output }}",
        "options": {
          "systemMessage": "You are a Marketing Performance Assistant.\n\nUse the data access campaign data, including fields like: campaign name, cost, impressions, clicks, conversions, and revenue.\n\n\n\nYour job is to write a clear and helpful summary of campaign performance for a marketing team.\n\nYour response must be in **JSON format** with only one field:\n\n- `\"output\"`: A string that contains:\n  - A short paragraph explaining overall performance\n  - 3\u20135 bullet points with key insights\n  - Total spend, impressions, clicks, conversions, and revenue (as bullets)\n\nUse natural, business-friendly language and make it sound like part of a weekly email report. Use emojis if helpful. Do not include raw data or tables.\n\n**Example format:**\n\n```json\n{\n  \"output\": \"Overall, campaign performance was strong this week. Retargeting efforts delivered the highest return, while a few awareness campaigns underperformed in conversions.\\n\\n\u2022 \ud83d\udcc8 'Spring Retargeting' had the highest ROAS at 9.1\\n\u2022 \ud83d\udcb0 'Loyalty Push' generated $12,000 revenue on $1,600 spend\\n\u2022 \ud83d\udcc9 'Awareness Boost - TikTok' had low conversions despite high spend\\n\u2022 \ud83e\udde0 Meta Ads accounted for 70% of total conversions\\n\\nTotals:\\n\u2022 Total Spend: $12,480\\n\u2022 Impressions: 983,400\\n\u2022 Clicks: 23,980\\n\u2022 Conversions: 1,482\\n\u2022 Revenue: $48,000\"\n}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "8167ef4f-9a26-4fb3-a885-79a5a5f3664a",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        304
      ],
      "parameters": {
        "color": 3,
        "width": 368,
        "height": 336,
        "content": "### 1. Set Up OpenAI Connection\n\n#### Get API Key:\n1. Go to [OpenAI Platform](https://platform.openai.com/api-keys)\n1. Go to [OpenAI Billing](https://platform.openai.com/settings/organization/billing/overview)\n2. Add funds to your billing account & copy your api key into the openAI credentials\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Combine": {
      "main": [
        [
          {
            "node": "Merge Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine ": {
      "main": [
        [
          {
            "node": "Merge Results",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Data": {
      "main": [
        [
          {
            "node": "Sum Campaigns",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sum Channels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sum Channels": {
      "main": [
        [
          {
            "node": "Combine ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Results": {
      "main": [
        [
          {
            "node": "Convert to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sum Campaigns": {
      "main": [
        [
          {
            "node": "Combine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Get Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Text": {
      "main": [
        [
          {
            "node": "Analyze Marketing Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Marketing Data",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Marketing Data": {
      "main": [
        []
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Marketing Data",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow pulls campaign data from Google Sheets, summarizes it using OpenAI, and sends a performance recap via Outlook email. In n8n, go to Credentials → click New Credential Select Google Sheets OAuth2 API Log in with your Google account and authorize Use a spreadsheet…

Source: https://n8n.io/workflows/7586/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.

OpenAI, HTTP Request, Form Trigger +7
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste

Telegram, Telegram Trigger, Google Drive +8
AI & RAG

Digistars - Scrape & Crawl. Uses httpRequest, n8n-nodes-firecrawl-scraper, googleSheets, lmChatOpenAi. Event-driven trigger; 63 nodes.

HTTP Request, N8N Nodes Firecrawl Scraper, Google Sheets +5
AI & RAG

This comprehensive n8n workflow automates the entire Meta (Facebook/Instagram) advertising process, from asset analysis to ad creation. It combines AI-powered content analysis with automated ad deploy

Facebook Graph Api, HTTP Request, Google Drive +5