Build an AI Email Sequence Generator Using Claude API and Google Sheets in 2 Hours
This article mentions a tool I use; the link at the end is an affiliate link.
Email sequences remain one of the highest-converting digital assets in 2026, but writing them manually takes hours. This tutorial shows you how to build a practical AI automation that generates personalized email sequences from a simple spreadsheet input—no fancy infrastructure required.
By the end, you'll have a working system that takes product details and outputs a 5-email nurture sequence in under 30 seconds.
What You'll Build
A Google Sheets-based tool that:
- Accepts product name, target audience, and key benefits as input
- Calls Claude API to generate a cohesive 5-email sequence
- Outputs formatted emails ready to paste into your email platform
- Costs roughly $0.15 per sequence to run
Prerequisites
- Google account (free)
- Anthropic API key (Claude) - $5 credit gets you started
- 90 minutes of focused time
- Basic comfort copying/pasting code (no prior coding needed)
Step 1: Set Up Your Google Sheet Structure
Create a new Google Sheet with these columns in row 1:
- A1: "Product Name"
- B1: "Target Audience"
- C1: "Key Benefit 1"
- D1: "Key Benefit 2"
- E1: "Key Benefit 3"
- F1: "Generated Sequence"
In row 2, add sample data:
- A2: "AI Recipe Planner"
- B2: "Busy parents"
- C2: "Saves 3 hours weekly"
- D2: "Reduces food waste"
- E2: "Kid-friendly options"
Step 2: Get Your Claude API Key
Go to console.anthropic.com and sign up. Navigate to API Keys and create a new key. Copy it immediately—you won't see it again. The first $5 of usage is typically free for new accounts, which covers about 30-40 sequence generations.
Step 3: Add the Apps Script
In your Google Sheet:
- Click Extensions > Apps Script
- Delete the default code
- Paste this script:
function generateEmailSequence() {
const sheet = SpreadsheetApp.getActiveSheet();
const row = sheet.getActiveRange().getRow();
const product = sheet.getRange(row, 1).getValue();
const audience = sheet.getRange(row, 2).getValue();
const benefit1 = sheet.getRange(row, 3).getValue();
const benefit2 = sheet.getRange(row, 4).getValue();
const benefit3 = sheet.getRange(row, 5).getValue();
const apiKey = 'YOUR_API_KEY_HERE';
const prompt = `Create a 5-email nurture sequence for "${product}" targeting ${audience}. Key benefits: ${benefit1}, ${benefit2}, ${benefit3}. Format each email with Subject: and Body: labels. Keep emails under 150 words each. Make email 1 a welcome, email 5 a soft pitch.`;
const options = {
method: 'post',
headers: {
'x-api-key': apiKey,
'anthropic-version': '2023-06-01',
'content-type': 'application/json'
},
payload: JSON.stringify({
model: 'claude-3-haiku-20240307',
max_tokens: 2000,
messages: [{
role: 'user',
content: prompt
}]
})
};
const response = UrlFetchApp.fetch('https://api.anthropic.com/v1/messages', options);
const result = JSON.parse(response.getContentText());
const sequence = result.content[0].text;
sheet.getRange(row, 6).setValue(sequence);
}
- Replace 'YOUR_API_KEY_HERE' with your actual Claude API key
- Click the save icon
- Name your project "Email Generator"
Step 4: Create a Custom Menu
Add this function below your existing code:
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('AI Tools')
.addItem('Generate Sequence', 'generateEmailSequence')
.addToUi();
}
Save again, then refresh your Google Sheet. You'll see a new "AI Tools" menu appear.
Step 5: Test Your Generator
- Click on cell A2 (your sample data row)
- Go to AI Tools > Generate Sequence
- Authorize the script when prompted (first time only)
- Wait 10-20 seconds
- Column F should populate with your 5-email sequence
Step 6: Refine Your Prompts
The magic is in prompt engineering. After your first test, modify the prompt variable to:
- Add tone specifications ("friendly", "professional", "humorous")
- Include CTA instructions ("end each email with a question")
- Specify formatting ("use bullet points in email 3")
Test different variations and save the best-performing prompt.
Turning This Into a Side Hustle
Once your generator works, here are three monetization paths I've seen work:
Service offering: Charge $50-150 to create custom email sequences for small businesses. Your input time: 15 minutes.
Template marketplace: Generate 20 high-quality sequences for different niches, package them as Notion templates or PDFs, sell for $29-79.
White-label tool: Duplicate your sheet, protect the script, share view-only access as a $19/month subscription.
When I was building out my own email automation workflow last year, I found that having a structured system for the non-AI parts—like organizing templates, tracking what worked, and setting up the actual email platform integrations—was just as important as the generation itself. A tool that helped with that systematic approach was Perpetual Income 365, which provided frameworks for the entire email marketing setup beyond just content generation. It's not required for this tutorial to work, but it filled in gaps around the business side that this technical automation doesn't cover.
Common Issues and Fixes
Error: "Exception: Request failed"
Your API key is likely incorrect. Double-check you copied it completely.
Sequence is too generic
Add more specific details in columns C-E. "Saves time" is weak; "Cuts meal planning from 2 hours to 15 minutes" is strong.
Cost concerns
Claude Haiku costs about $0.25 per 1M input tokens. A sequence uses roughly 600 tokens, so you'll get 50+ sequences per dollar.
Next Steps
Once comfortable, extend this system:
- Add columns for tone, length, or CTA type
- Create separate functions for social posts or landing page copy
- Build a simple web form that feeds this sheet using Google Forms
- Experiment with Claude Sonnet for higher-quality output (costs 5x more)
The core pattern—structured input → AI processing → formatted output—applies to dozens of content types. You now have a template to replicate.
Conclusion
You've built a practical AI automation that generates real value in minutes. Unlike generic ChatGPT prompting, this system is repeatable, scalable, and costs pennies per use. The businesses paying $200+ for email copywriters in 2026 are your potential clients.
Start with your own products or offer to generate sequences for one local business for free. Use that case study to land your first three paying clients. The automation handles the heavy lifting; you handle the strategy and client relationships.
The code is yours to modify, the approach is proven, and the market is active. Build it this weekend.
The tool mentioned above is an affiliate link (disclosed at top): Perpetual Income 365
Top comments (0)