Build an AI-Powered Email Sequence Generator Using Claude API and Google Sheets
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 takes hours. In this tutorial, you'll build a simple automation that generates personalized email sequences using Claude's API and Google Sheets—no complex coding required.
By the end, you'll have a working system that takes a product description and target audience, then outputs a 5-email nurture sequence you can customize and use.
What You'll Need
- Anthropic API account (free tier includes $5 credit)
- Google account (for Google Sheets and Apps Script)
- 30-45 minutes
- Basic familiarity with spreadsheets
Step 1: Set Up Your Google Sheet Template
Create a new Google Sheet with these columns:
- Column A: Product Name
- Column B: Target Audience
- Column C: Key Benefit 1
- Column D: Key Benefit 2
- Column E: Call to Action
- Columns F-J: Email 1 through Email 5 (output)
This structure lets you batch-generate sequences for multiple products or audiences.
Step 2: Get Your Claude API Key
- Go to console.anthropic.com
- Sign up or log in
- Navigate to API Keys section
- Create a new key and copy it
- Store it securely—you'll add it to Google Apps Script in the next step
The free tier gives you enough credits to generate hundreds of email sequences before you need to pay.
Step 3: Write the Apps Script Automation
In your Google Sheet:
- Click Extensions > Apps Script
- Delete the default code
- Paste this script:
function generateEmailSequence() {
const sheet = SpreadsheetApp.getActiveSheet();
const apiKey = 'YOUR_ANTHROPIC_API_KEY'; // Replace with your key
const row = sheet.getActiveRange().getRow();
// Get input data
const productName = 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 cta = sheet.getRange(row, 5).getValue();
const prompt = `Create a 5-email nurture sequence for:
Product: ${productName}
Audience: ${audience}
Key Benefits: ${benefit1}, ${benefit2}
Call to Action: ${cta}
Format each email with Subject: and Body:. Keep emails under 200 words. Email 1 should introduce value, emails 2-4 should educate and build trust, email 5 should present the offer.`;
const payload = {
model: 'claude-3-haiku-20240307',
max_tokens: 2000,
messages: [{
role: 'user',
content: prompt
}]
};
const options = {
method: 'post',
contentType: 'application/json',
headers: {
'x-api-key': apiKey,
'anthropic-version': '2023-06-01'
},
payload: JSON.stringify(payload)
};
const response = UrlFetchApp.fetch('https://api.anthropic.com/v1/messages', options);
const result = JSON.parse(response.getContentText());
const emails = result.content[0].text;
// Parse and insert emails (simplified - you may need to adjust parsing)
const emailArray = emails.split(/Email \d:/).slice(1);
for (let i = 0; i < 5 && i < emailArray.length; i++) {
sheet.getRange(row, 6 + i).setValue(emailArray[i].trim());
}
}
- Replace
YOUR_ANTHROPIC_API_KEYwith your actual key - Save the project (name it "Email Sequence Generator")
- Click Run to authorize the script
Step 4: Test Your Generator
-
Fill in row 2 of your sheet with sample data:
- Product Name: "Time Tracking App for Freelancers"
- Target Audience: "Freelance designers struggling with billing"
- Key Benefit 1: "Automatic time tracking"
- Key Benefit 2: "One-click invoicing"
- Call to Action: "Start 14-day free trial"
Select cell A2
Go to Extensions > Macros > generateEmailSequence
Wait 10-15 seconds
You should see five email drafts populate columns F through J.
Step 5: Refine and Deploy
The generated emails are starting points—always edit for:
- Brand voice consistency
- Specific examples from your product
- Legal compliance (especially for affiliate offers)
- Mobile readability
I learned this workflow while testing different automation frameworks, and one tool that helped streamline the template setup process was Perpetual Income 365, which provided pre-built email sequence structures I could adapt for the AI prompts. However, the method above works completely standalone.
Real-World Applications
For service providers: Generate custom sequences for each client niche you serve. A VA specializing in e-commerce could create sequences for abandoned cart, welcome series, and win-back campaigns.
For affiliate marketers: Build product-specific sequences at scale. Test different angles by changing the "Key Benefit" inputs.
For SaaS founders: Create onboarding sequences for different user personas without hiring a copywriter for every variant.
Cost Breakdown
Using Claude Haiku (the fastest, cheapest model):
- Each sequence generation: ~$0.01-0.02
- 100 sequences: ~$1.50
- Google Sheets & Apps Script: Free
Compare this to $200-500 for a copywriter to write one custom sequence.
Next Steps
Once you're comfortable with the basic version:
- Add a dropdown menu in your sheet to select tone (professional, casual, urgent)
- Include competitor analysis in the prompt
- Connect to your ESP's API to auto-upload sequences
- Build a simple web interface using Google Forms as input
Common Troubleshooting
"API key invalid" error: Make sure you copied the entire key with no extra spaces.
Emails not parsing correctly: The script uses a simple split method. Adjust the regex pattern in emails.split() based on how Claude formats the output.
Rate limits: The free tier has usage caps. If you hit them, wait 24 hours or upgrade to paid.
This automation won't replace strategic copywriting, but it eliminates the blank-page problem and gives you solid drafts in seconds. I use it weekly to test new angles before committing to manual refinement.
The key is treating AI as a drafting tool, not a replacement for understanding your audience. The best sequences come from combining AI speed with human insight about what actually converts.
The tool mentioned above is an affiliate link (disclosed at top): Perpetual Income 365
Top comments (0)