The 'Populate Word Document' Power Automate action enables you to populate a word document (DOCX) with data derived from a JSON document.
Basic 'Populate Word Document' Example
To use the 'Populate Word Document' Power Automate action, you'll need to pass the following information:
- File Content: The Microsoft Word Document (DOCX) to populate.
- Document Data: The JSON data to populate the document with.
If you are not familiar with JSON we recommend the following resource: JSON Introduction
Consider the following simple JSON object:
{
"companyName":"Encodian"
}
Configuring a word document to receive this data is very simple, just simply use this syntax to add a 'token':
<<[propertyName]>>
NB: the property / token name must start with a letter, not a number.
Example Document: Encodian - Template Syntax.docx
You do not need to add content controls or similar, you simply need to add some placeholder text to the document wrapped in the template syntax as a 'token', for example:
Configuring Power Automate is also very simple, consider the following flow:
Upon executing the flow, the Encodian population engine will automatically detect all tokens which should be replaced with the data contained within the JSON data provided, see below:
Document Content Formatting
Example Document: Encodian - Template Syntax - Formatting.docx
The data added to the document will automatically assume the formatting which has been applied to the token, for example:
Generate the following output:
You must ensure the formatting is applied to the token and not the property inside the token, for example, the following will not work:
3 Comments