Skip to main content

Generate PDF from Word Template in Zapier

What this guide covers

Instead of filling out the same contract, invoice, or certificate manually every time, you design it once in Microsoft Word - with {{placeholders}} where the dynamic values go - and let Zapier + PDF4me fill it in automatically. Every time a trigger fires (a form submission, a new spreadsheet row, a CRM deal closed), PDF4me merges your live data into the template and produces a finished PDF or Word document in seconds. No code, no mail-merge add-ins, no manual PDF exports. This guide walks through every step: building the template, structuring your data, configuring the Zapier action, and routing the output to storage or email.

How It Works

PDF4me uses Mustache double-brace syntax - {{VariableName}} - inside standard .docx files. You supply a data object (JSON, XML, or CSV) and PDF4me replaces every placeholder with the matching value, then renders the document as a PDF or DOCX.

Simple variables{{ClientName}}

Replaced with the matching JSON value

Repeating rows{{#Items}}...{{/Items}}

Expands one row per array item

Conditional blocks{{#ShowDiscount}}...{{/ShowDiscount}}

Section appears only when value is truthy

→ Full syntax reference: Word Template Syntax


Step 1 - Create Your Word Template

Open any .docx file in Microsoft Word and replace every value that should change per document with a {{placeholder}}. The placeholder name is what you will match in your JSON data - keep it short, descriptive, and consistent.

Common placeholders for typical documents:

Document typeExample placeholders
Invoice{{ClientName}}, {{InvoiceNumber}}, {{DueDate}}, {{Total}}
Contract{{PartyOne}}, {{EffectiveDate}}, {{Jurisdiction}}, {{SignatureDate}}
Certificate{{RecipientName}}, {{CourseName}}, {{CompletionDate}}, {{IssuedBy}}
Offer letter{{CandidateName}}, {{Position}}, {{Salary}}, {{StartDate}}

Tips for a clean template:

  • Use placeholders in table cells, headers, footers, and text boxes - PDF4me replaces them everywhere in the document
  • Keep the .docx styling (fonts, colors, borders) exactly as you want the output to look - PDF4me renders the document without altering formatting
  • For line-item tables, add one data row with {{#Items}} on the first cell and {{/Items}} at the end of the row - the loop expands automatically
Word document template with Mustache placeholders for client name, invoice number, and line items

A Word template with {{placeholders}} in body text, table cells, and headers. Save as .docx and store in Google Drive, Dropbox, or OneDrive.


Step 2 - Prepare Your Document Data

PDF4me accepts data in JSON (recommended), XML, or CSV format. JSON maps most naturally to Zapier trigger output because you can build the object directly from field references.

Minimal JSON example - invoice:

{
"ClientName": "Acme Corporation",
"InvoiceNumber": "INV-2026-0042",
"DueDate": "2026-06-15",
"Items": [
{ "Description": "Web design", "Qty": "1", "UnitPrice": "$3,200", "LineTotal": "$3,200" },
{ "Description": "Hosting setup", "Qty": "1", "UnitPrice": "$400", "LineTotal": "$400" }
],
"Subtotal": "$3,600",
"Tax": "$360",
"Total": "$3,960"
}

In Zapier, you can build this JSON string using the Code by Zapier step, or map it directly if your trigger (Typeform, Jotform, Google Sheets, HubSpot) already returns the fields you need.

Tip: Download the ready-made sample data file to see exactly how PDF4me expects the JSON structure - then adapt it to your template's placeholder names.

Zapier action showing document data field with JSON mapped from trigger

Map JSON data directly from trigger output fields or paste a static JSON string. Both approaches work - use whatever your Zap produces.


Step 3 - Configure the PDF4me Generate Document Action

Add a new action step in Zapier, search for PDF4me, and select Generate Document. Authenticate with your PDF4me API key once - Zapier reuses the connection across all your PDF4me actions.

Action Parameters

Required: Template Document Name, Template File, Data Format, and document data (as text or file). Output Format defaults to PDF if not set.

ParameterRequiredWhat it doesExample value
Template Document NameYesFilename of your Word template including the .docx extension. Map from the filename output of the step that retrieves your template file.invoice-template.docx
Template FileYesBinary content of the .docx template. Map from the file data output of a Google Drive Get File, Dropbox Download File, or OneDrive Get File step.(binary from Google Drive)
Data FormatYesFormat of the data you are supplying. JSON is recommended for Zapier workflows. XML and CSV are also supported.JSON
Data As TextOne of theseThe merge data as a text string - a JSON object, XML document, or CSV content typed or mapped directly in the field. Use this when building JSON from trigger fields in the same Zap.{"ClientName":"Acme","Total":"$3,960"}
Data FileOne of theseBinary data file containing the JSON, XML, or CSV. Use this when a prior Zap step retrieves a data file from cloud storage rather than constructing it inline.(binary from Dropbox)
Output FormatNoFormat of the generated document. PDF produces a tamper-proof, print-ready file. Word (DOCX) produces an editable document. Defaults to PDF.PDF
Output NameNoCustom filename for the generated document. Build it dynamically from trigger fields for organised storage - for example Invoice_{{InvoiceNumber}}.pdf.Invoice_INV-2026-0042.pdf
PDF4me Generate Document action in Zapier showing Template File, Data Format, and Data As Text fields configured

Map the template binary and set Data Format to JSON. Paste or map your JSON into Data As Text, or map a file from cloud storage into Data File.

PDF4me Generate Document action output format set to PDF and output name configured dynamically

Set Output Format to PDF for a print-ready file, or Word to keep the document editable. Use a dynamic Output Name built from trigger fields.


Step 4 - Save or Send the Output

The PDF4me action returns a File output - the generated PDF or DOCX binary. Map this into any downstream Zap step.

Cloud storage

Google Drive Upload File, Dropbox Upload File, OneDrive Upload File, SharePoint Create File - map FileFile Content and set a dynamic Folder Path and File Name.

Email delivery

Gmail Send Email, Outlook Send Email - map FileAttachment. Set the To address from a trigger field so each document goes to the right recipient automatically.

Both - store and send

Add both steps after the PDF4me action - upload to Drive and send via Gmail in the same Zap. Both steps receive the same File output, no duplication needed.

Zapier Google Drive Upload File step with File Content mapped from PDF4me output and dynamic folder path

Map the PDF4me File output into the File Content field of any storage or email step. Set Folder Path and File Name dynamically from trigger fields.

Zapier Gmail Send Email step with the generated PDF attached and recipient email mapped from form trigger

Attach the generated document directly to an email by mapping FileAttachment in Gmail or Outlook Send Email.


Complete Zap Flow

Complete Zapier workflow showing trigger, PDF4me Generate Document action, and Google Drive upload step

The complete Zap: trigger provides data → PDF4me merges it into the Word template → output saves to storage and/or sends via email.


Example Zap Flows

Example Zap FlowsReal automation patterns using PDF4me Generate Document with Word templates.
Typeform submission → Contract PDF → Email to client
  1. Typeform: New Entry - collects client name, project scope, start date, and agreed fee.
  2. Code by Zapier: builds a JSON object from the Typeform fields.
  3. Google Drive: Get File - retrieves the contract template .docx.
  4. PDF4me: Generate Document - merges JSON into template, output format PDF.
  5. Gmail: Send Email - attaches the contract PDF, sends to the client's email from the form.
Google Sheets new row → Invoice PDF → Save to Drive + notify Slack
  1. Google Sheets: New Row - a new invoice record added by your billing team triggers the Zap.
  2. Dropbox: Download File - retrieves the invoice template .docx from a shared templates folder.
  3. PDF4me: Generate Document - merges row data (client, items, amounts) into the template as JSON.
  4. Google Drive: Upload File - saves the invoice PDF to the matching client folder.
  5. Slack: Send Message to #billing - posts the invoice number and Drive link for the team.
HubSpot deal closed → Offer letter DOCX → Upload to SharePoint
  1. HubSpot: Deal Stage Changed to "Closed Won" - triggers when a sales deal is marked as won.
  2. HubSpot: Get Contact - retrieves the associated contact's name, email, and role.
  3. OneDrive: Get File Content - retrieves the offer letter template .docx.
  4. PDF4me: Generate Document - merges contact details and deal data; Output Format set to Word for further review.
  5. SharePoint: Create File - saves the DOCX to the HR folder for signature and onboarding.

Frequently Asked Questions

What placeholder syntax does PDF4me use in Word templates?+
PDF4me uses double curly brace Mustache syntax - {{VariableName}}. Place the placeholder anywhere in the Word document: body text, table cells, headers, footers, or text boxes. The name is case-sensitive and must exactly match the corresponding key in your JSON, XML, or CSV data. For repeating sections like invoice line items, use {{#Items}}...{{/Items}} loop syntax. For conditional sections that only appear when a value is present, use {{#ShowSection}}...{{/ShowSection}}.
What data formats does the Generate Document action accept?+
JSON, XML, and CSV. JSON is recommended because Zapier trigger output fields naturally map to JSON key-value pairs - you can build the JSON string inline using a Code step or directly paste a static object. XML and CSV are useful when your data source already produces those formats. Supply the data either as a text string in the Data As Text field or as a binary file in the Data File field.
Can I output a Word document instead of a PDF?+
Yes. Set Output Format to Word (DOCX) when the generated document needs further editing - for example a contract that goes through a tracked-changes review before signing, or an offer letter that HR wants to personalise before sending. Use PDF when you need a tamper-proof, print-ready output that cannot be accidentally edited after generation.
How do I handle repeating rows like invoice line items?+
In your Word template, add one row in the table with {{#Items}} at the start and {{/Items}} at the end of the row. Inside the row, use placeholders for each column - {{Description}}, {{Qty}}, {{UnitPrice}}, {{LineTotal}}. In your JSON data, supply Items as an array of objects: [{"Description":"Consulting","Qty":"8","UnitPrice":"$150","LineTotal":"$1,200"},{"Description":"Expenses","Qty":"1","UnitPrice":"$80","LineTotal":"$80"}]. PDF4me expands the loop and inserts a row for each array item automatically.
Where should I store the Word template so Zapier can access it?+
Store it in any cloud service Zapier can connect to - Google Drive, Dropbox, OneDrive, or SharePoint. Before the PDF4me Generate Document action, add a Get File step from the same service to download the binary content. Map the file binary into Template File and the filename into Template Document Name. The template stays in one place; every Zap run reads the latest version automatically - update the template once and all future documents use the new design.

Get Help