In this Power Automate tutorial, we will discuss Microsoft flow to create a word document from a template. We will see an example, how to create a word document from a template in Power Automate. And also we will discuss the below points:
- Microsoft flow create word document from template
- Power Automate create pdf from word template
- Power Automate create word document from SharePoint list
Microsoft flow create word document from template
Here we will see how to create a Word document From a template using Power Automate
First, we will create an invitation using a Word template, in this template we will change the Person Name dynamically.
Steps to create a Word document from a template using Microsoft Flow.
Step 1: Create a Word Template
I have already created a word template of invitation like the below image, by using Developer tools in MS Word desktop app. Here Person name will be updated automatically by MS Flow.
For example, if we give input the person name as Alex, so Name of the person, will change to Alex.
Then save that template on the desktop as a Word template i.e. in .dotx. And then in the MS Word app open that template, and save it word document as .docx file.
Once you save it as a word document, then upload that document to the SharePoint library.
Once you upload the template to the SharePoint library, now we will forward it to create a flow.
Step 2: Create a Flow
To create a Flow, Login to Power automate and then click on Create icon select Instant cloud Flow.
Next, provide the flow name, select Manually triggered flow, then click on Create.
Step 3: Manually triggered Flow
Now expand the Manually triggered flow action, then click on Add an input, and select As Text option. Then add the Input as Person Name.
Step 4: Populate a Microsoft Word Document
In this step, we will read the Microsoft Word template to fill the template fields (Person Name) with selected dynamic values to generate a word document. So, click on the Next step and select the Populate a Microsoft Word Document, and also to use this action you need a premium license.
Then provide the Location, Document Library, Files, and in Person Name select the Person Name from the dynamic content.
Now we will create a word document from the template, so click on the Next step and select Create File. Then provide the site address, folder path, file name, and File content from the dynamic content.
Now click on and run the flow Manually, and it will ask for the Person Name, like the below screenshot.
Now in SharePoint library Power automate created a word document from the template.
Open the Word document, you can see the person name is changed to Christen in the Word document invitation.
This is an example of how to create a word document from a template in Microsoft flow or Power Automate.
Read Power Automate Create File
Power Automate create pdf from word template
Here we will see how to create pdf from a word template using Microsoft Flow.
Now we will use the above word template to create a flow to convert it into pdf.
Once the template is ready, we will create a flowing Microsoft Flow.
Step 1: Create an Input
In Power Automate select the Manually triggered flow. Then expand this action and click on Add an input and select text, then in input provide the person Name.
Step 2: Populate a Microsoft Word template
In this step we will fill the field in the Microsoft template, so click on the Next step and select the Populate a Microsoft word template action. Then provide the Location, Document Library, select the word File, and in person Name select person from the dynamic content.
Step 3: Create File
Now we will create file, so click on the Next step and select Create file action, then provide the site address, folder path, File name and File content.
Step 4: Convert the word document to pdf
In this step we will convert the word document to pdf, so click on the Next step and select the Convert word document to pdf action and this action need a premium license, so click on the Next step and then provide the Location, Document Library, and then in File select the Name from the dynamic content.
Step 5: Create pdf file
Now we will create a file for the pdf file, so click on the Next step and select Create file action, then provide site address, folder path, file name with pdf expression, and file content.
Step 6: Delete word file
Now we will delete the word document file, so click on the Next step and select the Delete File action, then provide the site address, and File identifier.
Now click on Save and run the Flow, and input the person name. Then you can see the file converted with pdf.
This is an example of Power Automate create pdf from word template
Power Automate create word document from SharePoint list
Here we will see how to create a word document from a SharePoint list using Power Automate.
We will generate an offer letter word document for every new person joining the organization using the preferred values from a SharePoint list.
I have created a SharePoint list called offer letter data, so when a user adds a new person as an entry in the SharePoint list, it will automatically add the value to the properties in a word document.
Steps for Power Automate create word document from the SharePoint list.
Step 1: Create a Word Document
I have created a word document template in the desktop word app, with the three properties.
- Employee Name
- Date
- Salary
Once you have created a template save the template as .dotx and then open that template and save it as .docx document in the desktop.
After saving the document as .docx in desktop, upload the file to the SharePoint document library.
Step 2: Create SharePoint list
I have created a SharePoint list called offer letter, with the 4 columns and column type.
Column | Column type |
---|---|
Title | Single line of text |
Date of joining | Date and time |
Employee Name | Single line of text |
Salary | Single line of text |
Once the SharePoint list and word template is created, we will create a flow in Power Automate.
Step 3: Create a flow
To create a flow Login to Power Automate, then click on create and select Automated cloud flow.
Then provide the flow name, and select the trigger ‘When an item is created‘ action.
Step 4: When a new item is created
In this step provide the site address and list name of the list you have created in SharePoint.
Step 5: Populate a Microsoft word template
In this step, we will read the Microsoft word document, and fill the field in the Microsoft word template from the SharePoint list data.
So click on the Next step and select Populate a Microsoft word template action. Then provide the Location, Document library, and File. Then map the field of word template with SharePoint list field data.
Step 6: Create File
Now we will create a file in word document, so click on the Next step and select Create file action. Then provide the site address, folder path, file name and file content.
Once the flow is ready, we will run the Flow manually.
Step 7: Run the Flow
Now click on Save and to run the flow create an item in the SharePoint list like below.
Now you can see the Flow ran successfully and also you can see the word document is created.
And you can see the Properties are updated in Word template.
This is an example of how to create a word document from a SharePoint list in Power Automate.
Related Power Automate tutorials:
- How to call a flow from another flow in Power Automate
- Power Automate Set Variable
- Power Automate wait timer
- Power Automate update SharePoint list increment integer field
- How to move emails to folder after 30 days using Power Automate
- Power Automate delete all items in SharePoint list
In this Power Automate tutorial, we discuss Microsoft flow create a word document from a template. And also we discuss the below points:
- Power Automate create pdf from word template
- Power Automate create word document from SharePoint list
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
Can you provide the steps you used at the beginning to “create a word template of invitation…by using Developer tools in MS Word desktop app”? What developer tool allows you to add a custom field?
How to do word template of by using Developer tools in MS Word desktop app?