How to Populate a Word Template using Power Automate?

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.

Scenario:

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:

Populate a Word Template using Power Automate

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.

Populate a Word Template using Power Automate flow

In the word options, select the customized ribbon, then enable the Developer option, and click on the OK button.

Example to Populate a Word Template using Power Automate

Once the developer option has been enabled, we can view it in the Word document ribbon as highlighted below:

Example to Populate a Word Template using Power Automate flow

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.

See also  How to read a text and count its occurrence from a docx file in Power automate?

So Here I have used the Plain text content control and created a below Word document template.

Populate a Word Template using Power Automate

Step-2:

Once the Word document template is ready, upload the created Word Template document into the My Files in the OneDrive library.

Populate a Word Template using Microsoft flow

Step-3:

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.

Populate a Word Template using Microsoft flow example

Step-4:

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
Populate a Word Template using the Microsoft flow

Step-5:

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.

Example to Populate a Word Template in Power Automate

Step-6:

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)
How To Populate a Word Document Template with Power Automate

Step-7:

See also  Power automate split string into an array with examples

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
How To Populate a Word Document Template with Power Automate flow

Step-8:

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.

Populate a Word Document Template with Power Automate flow

Our complete flow looks like below:

Populate a Word Document Template with Power Automate

Step-9:

Save and Run the flow. Enter the details and click on the run flow option.

How To Populate a Word Document Template action in Power Automate flow

Once the flow runs successfully, like below:

How To Populate a Word Document Template in Power Automate

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:

How To Populate a Word Document Template action in Power Automate

This is how to use the Power Automate “Populate a Microsoft Word Template” action.

Conclusion

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.

See also  How to Highlight the Selected Item within a Power Apps Gallery?

You may also like:

>