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.
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

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
| Parameter | Required | What it does | Example |
|---|---|---|---|
| Connection | Required | PDF4me connection for the flow. Create one with your API key, then reuse it across every PDF4me action. | My PDF4me connection |
| Template Name | Required | The 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 Type | Required | Format of the data payload. Json maps cleanly from SharePoint columns and Forms. Xml is for XML source systems. | Json |
| Document Data Text | Conditional | Inline data payload built from dynamic content. Required when Document Data File is empty. | [{ "name": "Alice Johnson" }] |
| Document Data File | Conditional | A JSON, XML, or CSV data file mapped from a prior step. Required when Document Data Text is empty. | 1. Data |
| Metadata | Optional | Document 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 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.
| Field | Type | What it contains |
|---|---|---|
| Generated document | Binary | The 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 Name | String | Output filename derived from the template. Combine it with an expression such as guid() when you want unique filenames per run. |

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.