Are you struggling to populate a word into a word template using power automate flow? Then, this Power Automate tutorial will help you for sure. Here, I have clearly explained how to use the populate a word template action and populate the values in a Word document in Power Automate.
Recently, I got a requirement to populate a Job offer letter using the Populate a word template action in Power Automate.
For that, We have to enable the Word document in the developer option. Create a Word template file and upload it to the OneDrive. Here, I have created a Word template for a Job Offer Letter like the one below:
Later, we will create a flow that triggers manually and requests the employer to fill in the employee name, Date of Joining, and Report to the email address.
By using a Populate a Microsoft Word template action, populate the values into the Word document, then convert the file preview as PDF, and we will send an email to the user with the attachment.
Follow the below steps to Populate a Word Template using Microsoft Power Automate flow:
How to Populate a Word Template using Power Automate
Let us see how to use Populate a Word Template action using Power Automate flow,
Step-1: (Enable developer option in Microsoft Word)
To enable the developer option in Microsoft Word, Open Microsoft Word and select File -> More -> Options.
In the word options, select the customized ribbon, then enable the Developer option, and click on the OK button.
Once the developer option has been enabled, we can view it in the Word document ribbon as highlighted below:
Now, we will create a word template by selecting Plain Text Content control; while creating the word template, we shouldn’t select Rich Text content control because the word populate action doesn’t support rich text content control.
So Here I have used the Plain text content control and created a below Word document template.
Once the Word document template is ready, upload the created Word Template document into the My Files in the OneDrive library.
Now, we will create a flow to populate a word template; open the Microsoft Power Automate home page select the +create option, Enter the flow name, choose the manual trigger, and click on the create option.
Expand the manual trigger and add inputs for the Employer to fill in the Employee Name, Date of Joining, and Reports To email address.
- Employee Name – Text date type
- Date of Joining – Date type
- Reports To – Email type
Select + new step add a Populate a Microsoft Word template action from action triggers, and Configure the required parameters.
- Location – Select the location where the word template file exists (Here I have selected OneDrive for Business)
- Document Library – select the document library where the word template file exists ( OneDrive)
- File – select the word template file from the show picker.
Once the template file has been selected, it will return the plain text values presented in the template document.
From the dynamic content, pass the values to Populate a Microsoft Word template with the values of Date of Joining, Report To, and Employee Name.
Add a new step, choose create file action from action triggers, and provide the required parameters,
- Folder path – Select the folder path where you want to create a file (here, I have selected the root folder in OneDrive).
- File Name – From the dynamic content, pass the file name and add the file extension as .docx
- File Content – Choose the file content from the dynamic content of (Microsoft Word template action)
Select + new step and choose to convert file preview action from action triggers.
- File – Pass the ID from the dynamic content value
- Target Type – Choose the File target type as PDF
Add a new step and select the Send an Email (V2) action. Provide the required parameters,
- To – Select the user email from the dynamic content value
- Subject – Provide the subject of the mail ( here I have provided my subject as JOB OFFER LETTER)
- Body – Enter the body of the mail based on the requirement.
Expand the Show Advanced option; in the Attachment Name, pass the File Name, and in the Attachment content, pass the File Content from dynamic content value.
Our complete flow looks like below:
Save and Run the flow. Enter the details and click on the run flow option.
Once the flow runs successfully, like below:
The user will receive an email with the populated values in the document. Whenever the user opens the document they can view the populated values as highlighted below:
This is how to use the Power Automate “Populate a Microsoft Word Template” action.
In this Power Automate tutorial, I have clearly explained to you how to use the populate a word template action to populate the values in a Word document using Microsoft Power Automate. I have also explained how to use the “Convert File” preview flow action to convert the Word file to a PDF file and, finally, how to send an email to the user with the file as an attachment.
You may also like:
- Power Automate create a task in Microsoft Planner
- Power Automate Do until
- Power Automate Copy Folders
- Power Automate Copy Files
- How to Get File Content using Path in Power Automate
- How to Connect Power Automate Desktop to Cloud using Direct connectivity?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.