How to Merge Word Documents in Power Automate? [Using Encodian]

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.

Merge Word Documents in Power Automate

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>> 
How to merge word file using MS flow

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.

Merge Word Documents in Power Automate

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.

Power automate merge word files

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.
Merge Word Documents in Power Automate

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": [
Microsoft flow merge word documents

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']}" 
},
How to Merge Word Documents in Power Automate
MS flow merge word file

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:
 ] 
}
How to merge word file using Power Automate

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.
encodian merge word documents

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
How to merge word file using Microsoft Power Automate

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.
how to merge together word documents power automate

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.

how to merge together word documents using power automate

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:

>