Generate Marketing Reports from Google Sheets with GPT-4 Insights and PDF.co
This workflow pulls marketing data from Google Sheets, aggregates spend by channel, generates an AI-written summary, and outputs a formatted PDF report using a custom HTML template on PDF.co.
⚙️ Setup Instructions
1️⃣ Prepare Your Google Sheet
Copy this template into your Google Drive: Sample Marketing Data
Add or update your marketing spend data in rows 2–100.
Connect Google Sheets in n8n
Go to n8n → Credentials → New → Google Sheets (OAuth2)
Log in with your Google account and grant access
Select the Spreadsheet ID and Worksheet in the workflow
2️⃣ Set Up PDF.co for PDF Reports
Create a free account at PDF.co
In PDF.co Dashboard → HTML to PDF Templates, create a new Mustache template
Paste the HTML provided at the bottom of this description
Save, and note your Template ID
In n8n → Credentials → New → PDF.co API, paste your API Key and save
In the workflow, select your PDF.co credential in the Create PDF node
Replace the templateId with your Template ID
🧠 How It Works
Google Sheets Node**: Pulls marketing spend data
Summarize Nodes**: Aggregate total spend and spend per channel
OpenAI Node**: Writes a daily summary of marketing performance
Code Node**: Converts aggregated data into the correct shape for the PDF template
PDF.co Node: Generates a final, formatted **PDF report
📬 Contact
Need help customizing this (e.g., filtering by campaign, sending reports by email, or formatting your PDF)?
📧 robert@ynteractive.com
🔗 Robert Breen
🌐 ynteractive.com
📄 HTML Template (for PDF.co)
> Paste this into a new HTML Template on PDF.co and reference its Template ID in your workflow.
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Invoice {{invoiceNumber}}</title> <style> body { font-family: Arial, Helvetica, sans-serif; margin: 36px; color: #222; } .header { display: flex; justify-content: space-between; align-items: center; } .brand { max-height: 56px; } h1 { margin: 12px 0 4px; font-size: 22px; } .meta { font-size: 12px; color: #555; } .two-col { display: flex; gap: 24px; margin-top: 16px; } .box { flex: 1; border: 1px solid #ddd; padding: 12px; border-radius: 6px; } .label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: .02em; } table { width: 100%; border-collapse: collapse; margin-top: 16px; } th, td { border-bottom: 1px solid #eee; padding: 10px 8px; font-size: 13px; } th { background: #fafafa; text-align: left; } tfoot td { border-top: 2px solid #ddd; font-size: 13px; } .right { text-align: right; } .totals td { padding: 6px 8px; } .grand { font-weight: 700; font-size: 14px; } .notes { margin-top: 18px; font-size: 12px; color: #444; } </style> </head> <body>
Invoice {{invoiceNumber}}
Date: {{invoiceDate}} | Due: {{dueDate}}
{{#company.logoUrl}}
{{/company.logoUrl}}
From
{{company.name}}
{{company.address}}
{{company.phone}}
{{company.email}}
Bill To
{{billTo.name}}
{{billTo.address}}
{{billTo.email}}
Description Qty Unit Price Line Total
{{#items}}
{{line}}
{{description}}
{{qty}}
{{unitPriceFmt}}
{{lineTotalFmt}}
{{/items}}
Subtotal
{{subTotalFmt}}
Tax ({{taxRatePct}})
{{taxAmountFmt}}
Discount
-{{discountFmt}}
Total
{{totalFmt}}
Notes: {{notes}}
Terms: {{terms}}
</body> </html>
Related Templates
Use OpenRouter in n8n versions <1.78
What it is: In version 1.78, n8n introduced a dedicated node to use the OpenRouter service, which lets you to use a lot...
Task Deadline Reminders with Google Sheets, ChatGPT, and Gmail
Intro This template is for project managers, team leads, or anyone who wants to automatically remind teammates of tasks ...
🤖 Build Resilient AI Workflows with Automatic GPT and Gemini Failover Chain
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. How it works This...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments