Merge Word Documents


The 'Merge Word Documents' flow action merges up to 10 Microsoft Word documents provided in an JSON array to a single Microsoft Word document. 

Please refer to the Supported Document Types articles for a complete list of the different file formats / document types which are supported for conversion.

Default Parameters

The default 'Merge Word Documents' flow action parameters are detailed below:

  • Filename: The filename to assign to the resulting Microsoft Word document (including file extension).
  • Documents: An array of Microsoft Word documents and associated configuration

As a manually entered array:

  • Filename: The filename of the source Microsoft Word document (including file extension).
  • File Content: A Base64 encoded representation of the Microsoft Word document
  • Sort Position: Set the sort position for the document within the array, smallest number first.
  • Format Mode: Select how to handle merging Microsoft Word document styles.


As an array object:


Microsoft Word Format Support

The following Microsoft Word document types are supported:

  • docx
  • doc
  • dotx

Documents - JSON Schema 

The JSON provided within the documents parameter should conform to the following schema:

"fileName": "<Filename including extension>",
"fileContent": "<File contents (Base 64 string)>",
"sortPosition": <Optional - Sort position number>,
"wordInputFormatMode": "<Optional - Formatting type>"

Creating the JSON Array

Flow provides the actions required to build the JSON array which is required by the 'Documents' parameter. The following example shows how to retrieve documents from a SharePoint folder and dynamically build the array.

1. Utilise the 'Get Files (properties only)' action to retrieve a list of target files


2. (Optionally) Filter the list of target files returned by the action 'Get Files (properties only)' action. The example below filters the data to only items which originate from the 'Merge Array' folder.


3. Create a new variable which will be utilised to store the JSON we will provide to the 'Documents' parameter.


4. To build the array we will create a loop using the 'Apply to Each' action which will process each item from the filtered array created in step #2. The 'Body' variable is passed from the 'Filter Array' result. 


5. Add a 'Get file properties' action to retrieve the files properties, passing the ID of the current item. For reference use the expression below: 



6. Add a 'Get file content' action to retrieve the file, passing the identifier of the current item. For reference use the expression below:



7. Add an 'Append to array variable' action to add the JSON for the current document to the variable created in step #3.

The 'FilenameWithExtension' value can be obtained from the current item utilising the following expression: 


The file content (Base 64 string) can be obtained from the 'Get file content using path' actions return value as follows:



7. Add the 'Merge Word Documents' action.

8. Provide a 'Filename' value, click the 'Switch to input entire array' icon


9. Pass the 'FilesForMerge' variable created in step #3


10. Add a SharePoint 'Create file' action passing the returned filename and 'File Content' return values from the 'Merge Word Documents' action.


Execute the Flow to merge the targetted Microsoft Word documents into a single Microsoft Word document.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk