In this Power Automate tutorial, we will see how to merge Word documents in Power Automate.
For this, we will create a Manual trigger flow and we will merge the below two-word file into one using Power Automate. To do this we will use 3rd party action i.e. Populate the Word document from Encodian, which will merge the Word file.
To use this action from Encodian, we need API Key, you will get this by filling out the form to set up the free trial. When you will add the action to the flow, use the API Key and configure it.
How to merge Word documents using Power Automate
Here we will see how to merge Word documents using Power Automate Instant Cloud flow.
Before we will start creating the flow, you must make sure that you have the API Key, and you have the Word file in SharePoint Folder.
I will recommend you create a SharePoint library, inside that create a folder where you will add the word file which needs to merge.
Inside the library create a Word file (Template file) and add the below syntax, which will help us to merge the file.
<<foreach [f in files]>><<doc[f.file]>><</foreach>>
Once you are done with all the setup, follow the below steps to create the flow.
Step 1: Log in to Power Automate, click on +Create -> select Instant Cloud Flow.
Next, provide the flow name, and then select trigger action ‘Manually trigger a flow’. Click on Create. You can see the trigger action is added to the flow page.
Step 2: Click on the +New step -> select the Get file (properties only) action. Then provide the below information:
- Site address: Select the SharePoint site address.
- Library name: Select or Provide the Library name.
- Limit Entries to Folder: Select the folder.
Step 3: Click on the +New step, select Initialize variable action, then provide the below information:
- Name: Provide the name as File content
- Type: select the type as String.
- Value: provide the value as below syntax:
{
"files": [
Step 4: Next click on +New step -> select Get file content action. Then provide the below information:
- Site address: Select or provide the site address.
- File Identifier: Select the Identifier from the dynamic content. That will automatically add Apply to each action.
Next, click on Add an action, select Append to string variable action, then provide the below information:
- Name: Select the Name as Content
- Value Provide the value as below code:
{
"file": "@{body('Get_file_content')?['body']}"
},
Step 5: After that click on the +New step -> select Append to string variable action, then provide the below information:
- Name: Select the Name as Content
- Value Provide the value as below:
]
}
Step 6: Click on the +New step -> select the Get file content action. Then provide the below information:
- Site address: Select or Provide a SharePoint site address.
- File Identifier: Select the template file by clicking on the Folder icon.
Step 7: Now we will merge the content, so click on the +New step -> select the Populate the Word document. Then provide the below information:
- File content: Select the output body of the above action from dynamic content.
- Document Data: Select the variable from the dynamic content
Step 8: Now we will create the word file which contains both the word file content. So, click on the +New step -> select Create file action. Then provide the below information:
- Site address: Select or provide the SharePoint site address.
- Folder path: Provide the folder path.
- File name: Here I have provided the hardcoded file name, which you can see below. Or you can create a blank document and provide the file name here.
- File content: Select or Provide the file content of the above action output from dynamic content.
Step 9: To test the flow click on Test icon, click on the Test icon-> select Manually -> click on Test -> configure the action with connectors, then click on Run flow -> Then click on Done.
Now you can see your flow ran successfully. And you will go to the Library and open the final Word file, you can see the content is merged.
This is how you can merge Word files in Power Automate. Similarly, you can merge more than 2 files using this flow.
Conclusion
In this Power Automate tutorial, we saw how to merge two Word files in Power Automate using Encodian.
You may also like:
- create SharePoint site columns from an Excel file in Power Automate
- Add Item to SharePoint List from Excel using Power Automate
- Delete all rows from a SharePoint Online list using Power Automate
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.