Templates / Generate DOCX documents from Gmail using OpenAI, Google Sheets and Drive

Generate DOCX documents from Gmail using OpenAI, Google Sheets and Drive

Ready for 3.0

by AI Solutions ✓ · 4 views · created 2026-08-18 · Document Extraction, Multimodal AI

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-12-01.

📬 Weekly n8n 3.0 breakage alerts, free

What this workflow does

This AI workflow has 20 nodes and runs on Gmail events. Along the way it connects Gmail, Google Sheets, OpenAI and Google Drive.

How it runs

Trigger: On Gmail events.

  1. Set Deployment Configuration (Edit Fields (Set)): sets 8 fields: catalogSpreadsheetId, catalogSheet, outputFolderId…
  2. Validate Sender & Extract Request (Code): runs custom JavaScript code
  3. If: checks a condition and branches into true / false
  4. Fetch Template Catalog (Google Sheets): uses Google Sheets
  5. Build Template Catalog for AI (Code): runs custom JavaScript code
  6. AI Match Template & Extract Data (OpenAI): uses OpenAI
  7. Parse Template Match Decision (Code): runs custom JavaScript code
  8. If: checks a condition and branches into true / false
  9. Download Template Document (Google Drive): download
  10. Prepare No-Match Reply (Edit Fields (Set)): sets 1 field: replyBody

…plus 8 more steps. See the full node list below.

Services it uses

GmailGoogle SheetsOpenAIGoogle Drive

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

  • Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (When New Email Received).
Check at runtime on n8n 3.0
  • Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Informational: a static scan can't see the data, so test these on your own instance. Status above is unchanged.

Nodes used (10)

From the author

Quick Overview This workflow monitors Gmail for document-generation requests, validates the sender, looks up available DOCX templates in Google Sheets and Google Drive, uses OpenAI to select and fill the right template, converts the result to DOCX via a…

Excerpt from AI Solutions's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.