AutomationFlowsAI & RAG › AI Agent Sends Personalized Emails from Google Sheets

AI Agent Sends Personalized Emails from Google Sheets

Original n8n title: AI Agent to Send Emails From Google Sheets (video Tutorial)

ByMilan Vasarhelyi - SmoothWork @vasarmilan on n8n.io

[](https://www.youtube.com/watch?v=jxT6XO4eUwI)

Event trigger★★★★☆ complexityAI-powered12 nodesGoogle SheetsGmailGmail TriggerAgentOpenAI Chat
AI & RAG Trigger: Event Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → Gmail 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": "eb23cbf0-55cf-4f1c-a4bf-ee8598d6213e",
      "name": "Manual Trigger - Start Email Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "59af511c-c4fb-49d7-a8b4-0528ff378e4e",
      "name": "Get Pending Emails from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "To send",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 97715306,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit#gid=97715306",
          "cachedResultName": "Emails with AI"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit?usp=drivesdk",
          "cachedResultName": "Email Manager"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e1d68fb7-f3e8-457f-aab6-9f146ab07aaf",
      "name": "Send Personalized Email via Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        784,
        0
      ],
      "parameters": {
        "sendTo": "={{ $json.To }}",
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.Subject }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "508de6cd-00af-41df-af5e-8a37bc8b0e9a",
      "name": "Update Email Status to Sent",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1008,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Sent",
            "row_number": "={{ $('Get Pending Emails from Sheet').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "To",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Introduction",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Introduction",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Response",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Response",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 97715306,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit#gid=97715306",
          "cachedResultName": "Emails with AI"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit?usp=drivesdk",
          "cachedResultName": "Email Manager"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "066151f8-ec42-40a1-8856-2986b3164dfe",
      "name": "Gmail Trigger - New Email Responses",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        112,
        336
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "97530849-28a4-47d1-b9b1-4177dbe221bb",
      "name": "Get Matching Email Row by Sender",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        336
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.from.value[0].address }}",
              "lookupColumn": "To"
            },
            {
              "lookupColumn": "Response"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit#gid=0",
          "cachedResultName": "Emails"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit?usp=drivesdk",
          "cachedResultName": "Email Manager"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ff9cb97d-2960-4abb-b408-e1c4034d9dc6",
      "name": "Update Sheet with Email Response",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        336
      ],
      "parameters": {
        "columns": {
          "value": {
            "Response": "={{ $('Gmail Trigger - New Email Responses').item.json.text }}",
            "row_number": "={{ $json.row_number }}"
          },
          "schema": [
            {
              "id": "To",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Response",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Response",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit#gid=0",
          "cachedResultName": "Emails"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14XPphTi6va5o2c5bb4Ue3A6-B5aeZqi8oxAhThmKRi0/edit?usp=drivesdk",
          "cachedResultName": "Email Manager"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f916cc07-667a-4ad3-b383-bd547b2a3202",
      "name": "AI Agent - Generate Personalized Email",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        416,
        0
      ],
      "parameters": {
        "text": "=You are writing a short, personalized reminder email for a business owner who has registered for tomorrow's 9AM automation webinar. The message should feel warm and relevant \u2014 referencing something specific from their background to make it feel tailored, not generic. Keep the body to 2-3 sentences. Format it as an email with proper newlines and close with \"Best regards, The Automation Team\". Return only the email text directly \u2014 no subject line, no labels, no extra commentary.\nHere is an example of the expected output:\nHi Sarah,\nJust a reminder that your seat is reserved for tomorrow's automation webinar at 9AM \u2014 we think you'll find it especially useful given your work scaling operations at GreenLeaf Market. We'll be covering practical tools that can save you hours every week.\nBest regards,\nThe Automation Team\n\n {{ $json.Introduction }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "aeedf3ca-ce6d-4288-9fce-b5878c7717bf",
      "name": "OpenAI Chat Model - GPT",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        416,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "doc-note-1774531506930",
      "name": "Workflow Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -150
      ],
      "parameters": {
        "width": 600,
        "height": 1166,
        "content": "## Workflow Overview\n\nThis workflow automates sending and tracking emails directly from Google Sheets, saving hours of manual work each week. It reads email data from your spreadsheet, generates personalized content using AI, sends the messages via Gmail, and automatically tracks responses\u2014all without manual intervention.\n\n### First Setup\n\n**Required Credentials:**\n- Google Sheets OAuth2 connection for reading and updating spreadsheet data\n- Gmail OAuth2 connection for sending emails and monitoring replies\n- OpenAI API credentials for AI-powered email personalization\n\n**Google Sheet Structure:**\nCreate a spreadsheet with these columns:\n- **To**: Recipient email address\n- **Subject**: Email subject line\n- **Introduction**: Brief one-sentence recipient context for AI personalization\n- **Status**: Track email state (\"To send\" or \"Sent\")\n- **Response**: Captures reply content automatically\n\n### How It Works\n\n**Email Sending Branch:**\nManually triggered, this flow fetches all rows with Status = \"To send\", passes the Introduction field to an AI agent that generates personalized email content following your prompt template, sends the email via Gmail, and updates the Status to \"Sent\".\n\n**Response Tracking Branch:**\nRuns automatically every minute, monitoring Gmail for new messages. When a reply arrives, it matches the sender to your spreadsheet and logs the response content in the Response column.\n\n### Configuration\n\nReconfigure the Google Sheets document ID and sheet names to point to your own spreadsheet. Adjust the AI prompt template in the AI Agent node to match your email style and use case. Update Gmail credentials to your sending account."
      },
      "typeVersion": 1
    },
    {
      "id": "contact-note-1774531551220",
      "name": "Creator Contact Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -610
      ],
      "parameters": {
        "color": 5,
        "width": 600,
        "height": 440,
        "content": "# Contact Us:\n## Milan @ SmoothWork - [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n![Milan](https://gravatar.com/avatar/95700d17ba300a9f14c1b8cacf933df7720027b3adda9cbe6183d89142925422?r=pg&d=retro&size=100)\n\n\n### We help businesses eliminate busywork by building compact business tools tailored to your process.\n### Contact us for customizing this, or building similar automations.\n\n\ud83d\udce7 hello@smoothwork.ai\n\u25b6\ufe0f [Check us on YouTube](https://www.youtube.com/@vasarmilan)\n\ud83d\udcde [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n\ud83d\udcbc [Add me on Linkedin](https://www.linkedin.com/in/mil%C3%A1n-v%C3%A1s%C3%A1rhelyi-3a9985123/)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "video-note-1774531563388",
      "name": "Video Walkthrough",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -90,
        -610
      ],
      "parameters": {
        "width": 420,
        "height": 340,
        "content": "# Video Walkthrough\n[![image.png](https://vasarmilan-public.s3.us-east-1.amazonaws.com/blog_thumbnails/thumbnail_recrji7w9W5rhpyhr.jpg)](https://www.youtube.com/watch?v=jxT6XO4eUwI)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "OpenAI Chat Model - GPT": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Generate Personalized Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Pending Emails from Sheet": {
      "main": [
        [
          {
            "node": "AI Agent - Generate Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Matching Email Row by Sender": {
      "main": [
        [
          {
            "node": "Update Sheet with Email Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Personalized Email via Gmail": {
      "main": [
        [
          {
            "node": "Update Email Status to Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger - New Email Responses": {
      "main": [
        [
          {
            "node": "Get Matching Email Row by Sender",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger - Start Email Workflow": {
      "main": [
        [
          {
            "node": "Get Pending Emails from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Generate Personalized Email": {
      "main": [
        [
          {
            "node": "Send Personalized Email via Gmail",
            "type": "main",
            "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

[](https://www.youtube.com/watch?v=jxT6XO4eUwI)

Source: https://n8n.io/workflows/14374/ — 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

This workflow is for hotel managers, travel agencies, and hospitality teams who receive booking requests via email. It eliminates the need for manual data entry by automatically parsing emails and att

Google Sheets, Gmail, Agent +4
AI & RAG

Enterprise-grade resume screening automation built for production environments. This workflow combines intelligent AI analysis with comprehensive error handling to ensure reliable processing of candid

Gmail Trigger, Google Drive, HTTP Request +6
AI & RAG

AI Agents Vs AI Workflow. Uses lmChatOpenAi, gmailTrigger, gmail, gmailTool. Event-driven trigger; 30 nodes.

OpenAI Chat, Gmail Trigger, Gmail +7
AI & RAG

*Tags: AI Agent, Supply Chain, Logistics, Circular Economy, Route Planning, Transportation, GPS API*

Gmail Trigger, Output Parser Structured, Agent +4
AI & RAG

This template is for founders, finance teams, and solo operators who receive lots of invoices by email and want them captured automatically in a single, searchable source of truth. If you’re tired of

OpenAI Chat, Output Parser Structured, Gmail Trigger +4