GeminiSalesRevenue growthAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Auto-generate structured eBooks with n8n + Gemini Flash and export to Google Docs

Enter a title → Gemini generates chapter outline and structure → generates detailed content per chapter → writes to a Google Doc

Some experienceStepsWorkflowPrompt
Who
Content creators, marketers, and educators who need to batch-generate eBooks, whitepapers, or course materials
You get
After entering a topic in n8n, automatically output a complete Google Document eBook with a table of contents
You need
n8n · google-docs

Constraints

Prerequisites: self-hosted n8n instance (community nodes are incompatible with Cloud); Google Gemini API credentials (googlePalmApi) and Google Docs OAuth2 credentials (googleDocsOAuth2Api). Input: a title string in the n8n Set node. Cost: Gemini API billed by token; Google Docs is free.

What they did

Author ranjancse published a workflow template on the n8n template gallery. The template takes a title input, uses Gemini Flash 2.0 to generate a JSON structure with metadata and a chapter list, then calls Gemini chapter-by-chapter to write detailed content, finally aggregating everything into a single Google Document. The template contains 18 nodes, uses two LLM chains (structure generation + content generation), and one structured output parser.

How it went

Listed as a public template on n8n.io with 8,709 total views at time of collection (author_report). The author describes it as suitable for authors, marketers, educators, and others to rapidly generate eBooks. No specific quality assessment or A/B comparison data was provided.

Worth knowing

1. This workflow contains community nodes and is only compatible with self-hosted n8n, not n8n Cloud. 2. No built-in chapter length limits; long books may hit Gemini token limits or rate limits. 3. No direct workflow JSON download link is provided; import via the n8n template page or rebuild manually. 4. Output is plain text inserted into Google Docs without automatic formatting or table-of-contents hyperlinks. 5. This site has not tested the workflow; actual stability and output quality require independent verification.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • Google Gemini Chat Model node: connect Google Gemini/PaLM API credentials.
  • Create a Google Doc node: connect googleDocsOAuth2Api credentials.
  • Update Google Docs node: connect googleDocsOAuth2Api credentials.
  • Google Gemini Chat Model for Ebook thought creation node: connect Google Gemini/PaLM API credentials.

Configuration to replace

  • Source template is n8n public workflow #5707 (~18 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Set the input title

    In the n8n workflow, locate the "Set the Input Fields" node and replace the Title field with your eBook topic. Example: "Provide me n8n beginners guide with chapters and high-level steps". After execution, this title flows into the next LLM chain.

  2. Generate chapter structure (JSON mode)

    The "Ebook Thought Creation" node calls Gemini Flash to expand the title into a JSON object with metadata and a chapter list. It connects to a "Structured Output Parser" that enforces a fixed JSON Schema (fields: type, version, metadata, structure.chapters). A "Code" node then extracts the chapters array for downstream looping.

    Execution prompt · Source text。Ebook Thought Creation node text parameter (promptType=define)

    ={{ $json.Title }}
    
    Make sure to output as JSON
  3. Generate detailed content per chapter

    The "Loop Over Items" node iterates over the chapters array. On each iteration, the "Set the title, objective" node formats the current chapter's title and objectives, then the "Generate Detailed Chapter Content" node calls Gemini to write the full chapter text. The loop continues until all chapters are processed.

    Execution prompt · Source text。Generate Detailed Chapter Content node text parameter (promptType=define)

    =Provide a detailed chapter explanation for the following
    
    Title : {{ $json.title }}
    Objective : 
    {{ $json.objectives }}
  4. Create and update Google Doc

    On first execution, the "Create a Google Doc" node creates a new document titled with the book name (from the "Set the title, objective" node). Then the "Update Google Docs" node inserts the generated chapter content. After each chapter, the loop returns to "Loop Over Items" until all chapters are written to the same document.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant; first confirm self-hosted environment and credential configuration

This block is the prompt. Ads are never placed here.

You are an n8n workflow setup assistant. The user wants to recreate the "Generate structured eBooks with Gemini to Google Docs" template. Assist in this order:
1. Confirm the user has a self-hosted n8n (community nodes requirement).
2. Guide them to import workflow ID 5707 from the n8n template gallery, or manually recreate the nodes and connections.
3. Check credentials: googlePalmApi (Gemini) and googleDocsOAuth2Api (Google Docs).
4. Prompt the user to change the Title in "Set the Input Fields" to their actual topic.
5. Suggest a first execution to verify the JSON structure output from "Ebook Thought Creation".
6. If there are many chapters, warn about Gemini rate limits and token consumption.

Change the title before running; verify JSON structure output on first run

Source

Create structured eBooks in minutes with Google Gemini Flash 2.0 to Google Docs · ranjancse · n8n.io · 2025-07-05

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related