Skip to main content

Generate Document Using Template in Power Automate

Generate Document Using Template is a Power Automate action that merges a saved PDF4me template with JSON, XML, or CSV data and returns a generated document. Use it when the template already lives in your PDF4me repository instead of being mapped as a file. Select the template by name, paste or upload the data, and map the output downstream.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

Every PDF4me action in Power Automate requires a valid connection. Create or select one that holds your PDF4me API key.

Important Facts You Should Not Miss

The template is selected by name
Upload the .docx to your PDF4me templates first so it appears under Template Name. This action does not map a template binary from SharePoint or OneDrive. Download the sample google-docs-template.docx if you need a starting file.
Provide text or a data file, not both
Document Data Text is for inline JSON or XML built from dynamic content. Document Data File is for a JSON, XML, or CSV file from a prior step. Fill one field and leave the other empty.
Different from Generate Document Single
Generate Document Single maps a template file and exposes Template File Type plus Output Type. This action reads a saved template by name. For a Google Docs export walkthrough, see the Google Docs variant page.
PDF4me Generate Document Using Template action in Power Automate with Template Name set to google docs, Document Data Type set to Json, and Document Data Text holding sample JSON for Alice Johnson

Target configuration: a saved template selected under Template Name, Document Data Type set to Json, and the payload pasted into Document Data Text.

What is Generate Document Using Template in Power Automate?

Generate Document Using Template is Power Automate's PDF4me action for merging a template that already lives in your PDF4me account with a data payload. It accepts a template name plus JSON, XML, or CSV and returns a generated document as dynamic content. Unlike Generate Document Single, you do not map a template file or pick an Output Type on this action.

Parameters

ParameterRequiredWhat it doesExample
ConnectionRequiredPDF4me connection for the flow. Create one with your API key, then reuse it across every PDF4me action.My PDF4me connection
Template NameRequiredThe saved template to merge, selected by name from your PDF4me templates. Upload the .docx first so it appears in the list.google docs
Document Data TypeRequiredFormat of the data payload. Json maps cleanly from SharePoint columns and Forms. Xml is for XML source systems.Json
Document Data TextConditionalInline data payload built from dynamic content. Required when Document Data File is empty.[{ "name": "Alice Johnson" }]
Document Data FileConditionalA JSON, XML, or CSV data file mapped from a prior step. Required when Document Data Text is empty.1. Data
MetadataOptionalDocument metadata for fields in JSON format, for templates that reference metadata at render time. Leave empty for most cases.{"title":"Certificate"}

The sample payload below matches the placeholders in google-docs-template.docx. Paste it into Document Data Text, or upload the matching JSON as Document Data File.

[
{
"name": "Alice Johnson",
"course": "Intro to Automation",
"date": "2026-03-10",
"instructor": "Mr. Smith"
}
]
A Power Automate flow with a manual trigger, the PDF4me Generate Document Using Template action, and a Dropbox Create file action, each showing a green success check

A minimal flow: a trigger, Generate Document Using Template, then a step that saves the generated file.

Output

The action returns the generated document as dynamic content. Map it into any downstream step that accepts file content.

FieldTypeWhat it contains
Generated documentBinaryThe merged document produced from the saved template and your data. Map it into File Content of Create file (Dropbox, OneDrive, SharePoint) or into an Outlook attachment.
File NameStringOutput filename derived from the template. Combine it with an expression such as guid() when you want unique filenames per run.
Dropbox Create file action in Power Automate with Folder Path set to /pdf4meoutput, File Name built from guid() plus the generated document, and File Content mapped to the generated document

Saving the result: map the generated document into File Content, and use guid() in File Name for a unique output name.

How does Generate Document Using Template work in Power Automate?

Power Automate sends the selected template name and your data payload to PDF4me. PDF4me loads the saved template, merges mustache-style placeholders such as {{name}} through the Word template engine, and returns the generated file as dynamic content. Per the Power Automate expressions reference, you can wrap the output File Name with guid() so each run writes a unique file. For placeholder syntax see the Aspose Words for .NET documentation.

Common Questions

How do I use Generate Document Using Template in Power Automate?+
Add the PDF4me Generate Document Using Template action, pick a saved template under Template Name, set Document Data Type to Json, and paste the payload into Document Data Text (or map a data file). Then map the generated document into Create file or Send an email. Upload google-docs-template.docx to your PDF4me templates first if the dropdown is empty.
What is the difference between Generate Document Using Template and Generate Document Single?+
This action reads a template already stored in your PDF4me account by name. Generate Document Single maps a template file from SharePoint, OneDrive, or another prior step and exposes Template File Type plus Output Type. Use Single when the template file moves with the flow; use this action when the template is managed in PDF4me.
Where do I upload the template for Generate Document Using Template?+
Upload the .docx to your PDF4me templates in the PDF4me dashboard. After it is saved, it appears in the Template Name dropdown. Design the file in Word or export it from Google Docs as Microsoft Word (.docx). This action does not take a mapped Template binary.
What data formats can I pass to Generate Document Using Template?+
Set Document Data Type to Json or Xml. Document Data Text takes an inline payload built from dynamic content. Document Data File accepts an uploaded JSON, XML, or CSV file. Matching sample data lives next to the Google Docs pack at google-docs-data.json.
Where does the generated file go in a Power Automate flow?+
The action returns the generated document as dynamic content. Map it into Create file (Dropbox, OneDrive, SharePoint) or Outlook Send an email with attachment. Use guid() in File Name so each run writes a unique output.