n8n tutorial - Lesson 13: Batch Blog Writing with n8n: 10 Posts Automatically
Hi everyone, in this post we walk through building a 13-node n8n batch processing workflow that reads 10 blog topics from Google Sheets, writes each post with AI, generates a cover image, and publishes a draft to Blogger — automatically. This is part of the n8n Workflow Automation Tutorial series, and it covers real production lessons including rate limits, idempotent state management, and the difference between Output Parser and manual Code Parse.
How to do:
Step 1 — Create the Topic Sheet as State Storage
The Google Sheet acts as both the input queue and the state tracker — this is the idempotent batch pattern that prevents duplicate posts on re-runs.- Create a new Google Sheet named T4-B5-Blog-Topics.
- Add two columns:
topicandstatus. - Enter your 10 blog topics in the
topiccolumn, leavingstatusblank for all rows. - Note the Sheet ID from the URL — you will need it in the Sheets nodes later.
Production tip — The status column is the key to idempotency. When a topic is processed, the workflow marks it done. On the next run, a filter skips those rows automatically — so re-running the workflow never creates duplicate posts.
Step 2 — Duplicate the Existing Single-Post Workflow
Start from the verified single-post pipeline (T4-B2) instead of building from scratch, then replace the manual topic input with Sheets-driven input.- Open your existing single-post workflow in n8n.
- Click ⋮ → Duplicate and rename the copy to
T4-B5-Blog-Batch. - Delete the Manual Trigger's Set Topic node that previously hardcoded the topic value.
- You will replace it with two new nodes: Get Topics (Sheets) and Limit — covered in the next steps.
Step 3 — Add the "Get Topics" Node (Google Sheets)
This node reads all rows from your topic sheet so the workflow can iterate over each one.- Add a Google Sheets node after Manual Trigger, set operation to Get Many Rows.
- Select your credential, set the Sheet ID to your T4-B5-Blog-Topics sheet ID.
- Rename this node to
Get Topics— the name matters because downstream nodes reference it explicitly. - Note: the Google Sheets Get Many Rows operation has no native Limit option — you must add a separate Limit node after it.
Tip — Add a Filter node between Get Topics and Limit to skip rows where status equals done. Without this filter, the workflow will attempt to re-process completed topics on every run.
Step 4 — Add the Limit Node for Batch Size Control
The Limit node controls how many topics are processed per run — essential for staying within API rate limits during testing.- Add a Limit node after Get Topics (or after your Filter node).
- Set Keep to
2for initial testing, then increase to3, then10— follow the gradual scaling pattern. - Never jump straight to 10 items on a first run; test with 1, then 3, then the full batch.
Production tip — The gradual "Test 1 → Test 3 → Test 10" pattern exists because test passes on 1–2 items do not guarantee a full batch will pass. Rate limits and cumulative token usage only surface at scale.
Step 5 — Update All Node References from Set Topic to Get Topics
Every downstream node that previously referenced$('Set Topic') must be updated to reference $('Get Topics') — there are six of them, not five.
- Search every LLM node, prompt, and field expression for
$('Set Topic'). - Replace each occurrence with
$('Get Topics').item.json.topic. -
The six nodes that need updating are:
- AI Outline
- AI Write Body
- Claude SEO
- AI Image Prompt
- Format HTML
- Upload to Drive — this one is easy to miss
- Use
$('Get Topics').item.json.topicrather than the shorter$json.topic— the short form only works in the immediately downstream node, not across the full pipeline.
Note — $json.topic works only in the direct child of the node that outputs topic. For any node further downstream, always use the explicit $('NodeName').item.json.fieldName form for robust, production-safe references.
Step 6 — Configure the AI Nodes with Correct Settings
Four LLM Chain nodes power the content generation pipeline — each needs the right model, token limit, and error handling settings.- Set all four LLM nodes (AI Outline, AI Write Body, Claude SEO, AI Image Prompt) to use Claude Haiku — not Sonnet — to stay within Tier 1 rate limits.
-
For AI Outline, set Max Tokens to
8192:- Vietnamese text consumes approximately 3× more tokens than English.
- Leaving Max Tokens at the default causes the outline to be cut off mid-output, which then breaks the downstream parser.
- Enable Retry on Fail on all four root LLM Chain nodes: set retries to
2, wait to3seconds. - Enable Continue on Fail on the same four root nodes so a single item failure does not kill the entire batch.
- Do not set Retry on Fail on the Output Parser / Structured Output sub-nodes — they do not call any external API, so retrying them has no effect.
- Do not set Continue on Fail on the Output Parser sub-nodes either — n8n's own error message specifies that error handling must be set on the root node's settings, not the sub-node.
Note — When debugging LLM errors, read the full API error message first. Claude's error responses explicitly include model:, org:, and limit: fields. These tell you the actual model being used and the exact limit hit — without reading this, you will waste time guessing the wrong root cause.
Step 7 — Replace Structured Output Parser with a Code Parse Node
When the AI wraps its JSON output in markdown code fences, the Structured Output Parser fails — a manual Code Parse node is more robust for production use.- Remove the Structured Output Parser sub-node from the AI Outline node.
- Add a Code node after AI Outline and name it
Code Parse Outline. -
Paste this script into the Code node:
let text = $input.item.json.text; text = text.replace(/^```json\s*/i, '').replace(/^```\s*/, '').replace(/```\s*$/, ''); text = text.trim(); let parsed = JSON.parse(text); return { json: { output: parsed } }; - This strips any markdown fencing the model adds around JSON and parses the result cleanly.
Production tip — Use Code Parse when the AI output schema is complex or when the model inconsistently adds markdown fencing. Use the Structured Output Parser only when the model reliably returns clean JSON — which is less common with longer outputs or Vietnamese-language prompts.
Step 8 — Add the Mark Done Node
The final node in the workflow updates the Sheet to mark each processed topic asdone — this is the second half of the idempotent pattern.
- Add a Google Sheets — Update Row node at the end of the workflow, after POST Draft Blogger.
- Name it
Mark Done. - Set the match column to
topicand the value to$('Get Topics').item.json.topic. - Set the
statuscolumn value todone. - After this node runs, re-executing the workflow will automatically skip any row with
status = done.
Tip — The Sheet is not just a data source — it is the workflow's memory. Think of it as the filter that controls what enters the pipeline on every run. Design your Sheet schema carefully at the start of any batch automation project.
Step 9 — Verify the Full 13-Node Pipeline
The complete workflow should match this exact node sequence before you run any batch test.-
Confirm your workflow has these 13 nodes in order:
- Manual Trigger
- Get Topics (Google Sheets — Get Many Rows)
- Filter (skip status = done)
- Limit (set to 2 for first test)
- AI Outline (Claude Haiku, Max Tokens 8192)
- Code Parse Outline (Code node)
- AI Write Body (Claude Haiku)
- Claude SEO (Claude Haiku)
- AI Image Prompt (Claude Haiku)
- DALL-E Generate
- Download Image
- Upload to Drive
- Make Public
-
Then confirm these final nodes complete the pipeline:
- Format HTML
- POST Draft Blogger
- Mark Done (Google Sheets — Update Row)
- Run with Limit = 2 first and confirm both items complete without errors before increasing the batch size.
Step 10 — Handle Rate Limits for Batch Runs
Anthropic Haiku Tier 1 has a hard limit of 10,000 output tokens per minute — running four LLM nodes across 10 items simultaneously triggers a cascade failure.-
Understand the cascade failure pattern:
- AI Outline, AI Write Body, Claude SEO, and AI Image Prompt each generate output tokens.
- Across 10 items, cumulative output easily exceeds the 10K/min Tier 1 cap.
- When an LLM node fails, the downstream Code Parse node receives no input and also fails.
- DALL-E then receives no image prompt and fails too — the entire batch collapses.
-
To work within Tier 1, choose one of these three approaches:
- Option A — Reduce batch size: Keep Limit at 3 and run multiple times (the idempotent Sheet pattern makes this safe).
- Option B — Add Wait nodes: Insert a Wait node (60 seconds) between LLM steps to spread token usage across time.
- Option C — Upgrade API tier: Move to Anthropic Tier 2 for a higher output token limit per minute.
- For the current session, use Option A with Limit = 3 — the pipeline pattern is fully verified, and the idempotent Sheet means you can safely re-run until all 10 topics are processed.
Production tip — A pipeline that passes on 1–2 items is not proven production-ready. Always test at 1, then 3, then the full batch size. Rate limits and cumulative failures only become visible at scale — this is the most important lesson from building this batch workflow.
Key Lessons from This Session
- Use explicit node references, not shorthand.
$('Get Topics').item.json.topicworks across the entire pipeline;$json.topiconly works in the immediate child node. - Google Sheets has no native row limit option. Always add a separate Limit node after a Sheets Get Many Rows node.
- Set Retry on Fail only on root LLM Chain nodes. Output Parser sub-nodes make no API calls, so retrying them does nothing.
- Set Continue on Fail only on root LLM Chain nodes, not sub-nodes. n8n's error message explicitly says to use the root node's settings — read it before configuring.
- Read the full API error message before guessing. Claude's error responses include the exact model, org, and limit values — this tells you the real cause immediately.
- Set Max Tokens before assuming a format issue. A truncated AI output that fails to parse is almost always a Max Tokens problem, not a prompt or schema problem.
- Mass production reveals bugs that small tests hide. Cascade failures, rate limits, and token overflows only surface when you run the real batch size.
- The Sheet is the workflow's memory and filter. The two-component idempotent pattern — Filter (skip done) + Mark Done (update status) — is universal for any batch automation pipeline.
- Code Parse is more robust than Structured Output Parser for complex schemas. Use Code Parse when the model inconsistently wraps JSON in markdown fencing.
- Gradual scaling is mandatory: Test 1 → Test 3 → Test 10. Never run a full batch without first verifying smaller subsets pass cleanly.
Conclusion:
This session completed a fully verified 13-node n8n batch processing pipeline that reads topics from Google Sheets, generates AI-written blog posts with cover images, and publishes drafts to Blogger — with idempotent state management so it can be safely re-run. The main constraint for full 10-item batches is Anthropic Tier 1 rate limits, which is solved by reducing batch size per run, adding Wait nodes, or upgrading to Tier 2. In the next post in this n8n tutorial series, we move to YouTube automation — building a pipeline that polls for new comments, classifies them with Claude, and drafts replies for human review.
If you have any questions, feel free to leave a comment below. Thank you!
Tags: n8n batch processing, n8n tutorial, n8n workflow automation, n8n Google Sheets, n8n rate limit, n8n AI blog writing, n8n DALL-E image generation, n8n idempotent workflow
Maybe you are interested!
- Getting Started with n8n: Interface & Your First Manual Trigger
- n8n HTTP Request Node: Connect Any API Without Code
- Branching Workflows: IF, Switch & Merge Nodes in n8n
- n8n Expressions & Built-in Variables: The Complete Guide
- Comparing AI Models in n8n: Claude vs Gemini vs ChatGPT
- Connect Gmail to n8n: OAuth Setup & Reading Emails
- Build an AI Email Classifier with n8n
- Automated Email Digest to Telegram with n8n
- Google Sheets Automation with n8n: 4 Key Operations
- Auto-Generate Google Docs from Data with n8n
No Comment to " n8n tutorial - Lesson 13: Batch Blog Writing with n8n: 10 Posts Automatically "