{"product_id":"gmail-docx-generator-with-openai-sheets-drive-n8n-workflow","title":"Gmail DOCX Generator with OpenAI, Sheets \u0026 Drive | n8n Workflow","description":"\u003ch3\u003eTurn Gmail requests into ready-to-send DOCX files—automatically\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow listens for new emails in Gmail, matches the request to the correct DOCX template stored in Google Drive (using OpenAI + a Google Sheets template catalog), generates a filled DOCX via a Pandoc HTTP conversion service, uploads it back to Google Drive, and replies in the same email thread with the attachment and a Drive link.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTriggers on new Gmail messages\u003c\/strong\u003e and extracts the sender, subject, and body text.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates authorization\u003c\/strong\u003e by checking allowed sender domains and a required keyword.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLoads a template catalog from Google Sheets\u003c\/strong\u003e (Title, Aliases, FileId, FileName) and formats it into a searchable list for AI matching.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUses OpenAI to select the best matching template\u003c\/strong\u003e and extracts recipient details and other fields. If no template fits, it replies with an “unable to match” message.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDownloads the DOCX template from Google Drive\u003c\/strong\u003e and uses OpenAI to reproduce it as \u003cem\u003efilled GitHub-flavored Markdown\u003c\/em\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eConverts Markdown to DOCX\u003c\/strong\u003e by sending the Markdown to a \u003cstrong\u003ePandoc conversion HTTP endpoint\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUploads the generated DOCX to Google Drive\u003c\/strong\u003e and \u003cstrong\u003ereplies via Gmail\u003c\/strong\u003e in the original thread with the document attached and a Drive link.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eGenerating personalized contracts, letters, or proposals when a client emails a structured request.\u003c\/li\u003e\n  \u003cli\u003eProducing standard onboarding or HR documents based on a keyword + sender authorization.\u003c\/li\u003e\n  \u003cli\u003eSaaS ops teams automating document fulfillment without manually selecting templates.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n integrations:\u003c\/strong\u003e Gmail trigger + Gmail reply actions, Google Sheets, Google Drive, OpenAI, and a Pandoc HTTP conversion endpoint.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWorkflow logic nodes:\u003c\/strong\u003e if, set, code, no op, plus sticky note for documentation.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSetup requirements:\u003c\/strong\u003e Gmail OAuth2 (trigger + replies), Google Sheets\/Drive OAuth2 and a template catalog sheet, OpenAI credentials for the two OpenAI steps, and a configured Pandoc HTTP endpoint.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45869896270003,"sku":"N8N-18429","price":25.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/1CbhuEhieoGJGMJ6kg5pl_oJnquQJS.png?v=1787130719","url":"https:\/\/buyflowscripts.com\/products\/gmail-docx-generator-with-openai-sheets-drive-n8n-workflow","provider":"N8N Commerce","version":"1.0","type":"link"}