The 'Merge Word Documents' flow action merges up to 1000 Microsoft Word documents provided in a 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.
Please refer to the following article showcasing the 'Merge Word Documents' flow action: Build a proposal document dynamically using SharePoint and Flow
The default 'Merge Word Documents' flow action parameters are detailed below:
- Filename: The filename to assign to the resulting Microsoft Word document (including the 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 the 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, lowest number first.
- Format Mode: Select how to handle merging Microsoft Word document styles.
- KeepSourceFormatting: To maintain the current documents styles
- KeepDifferentStyles: Allows styles to be reused if they are identical to the styles within the source document. If styles are different to the destination then they are imported.
- UseDestinationStyles: Re-uses styles within the destination document.
As an array object:
The advanced 'Merge Word Documents' flow action parameters are detailed below:
- Time Zone: Set a specific time zone for date and time processing.
Microsoft Word Format Support
The following Microsoft Word document types are supported:
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>"
Please review the following article if you experience an issue executing the 'Merge document array to PDF' action: Errors processing Document Arrays
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. Configure the 'Get Files (properties only)' action to retrieve a list of target files
2. Optional - Configure the 'Limit Entries to Folder' property to target documents contained within a specific SharePoint folder.
3. Create a new variable which will be utilised to store the JSON which we will later provide to the 'Documents' parameter of the 'Merge document array to Word' action.
4. Add an 'Apply to Each' action, selecting the 'value' variable returned from the 'Get files (properties only)' action.
5. Inside the 'Apply to Each' action; Add a 'Get file properties' action to retrieve the files properties, passing the ID of the current item:
6. Inside the 'Apply to Each' action; Add a 'Get file content' action to retrieve the file. Select the 'Identifier' field from the 'Get file properties' action.
The action configuration should be as follows:
7. Inside the 'Apply to Each' action;
7.a. Add an 'Append to array variable' action to append JSON data to the variable created in Step 3. Copy and paste this JSON snippet into the 'Value' field:
7.b Place the cursor as per the image and select the 'File name with extension' property from the SharePoint 'Get files properties' action.
7.c. Place the cursor as per the image and select the 'File Content' property from the SharePoint 'Get file content' action.
7.f Once copied the action configuration should be as follows:
8. Underneath the 'Apply to Each' action; Add the 'Merge Word Documents' action.
8a. Provide a 'Filename' value, then click the 'Switch to input entire array' icon
8b. Select and delete any existing data within the 'Documents' field:
8c. Select the 'Document Array' variable created in step #3
9. Add a SharePoint 'Create file' action and set the 'Site Address' and 'Folder Path' fields as required.
9a. File Name: Select the 'Filename' field from the 'Merge Word Documents' action.
9b. File Content: Select the 'File Content' field from the 'Merge Word Documents' action.
10. The completed flow should look as follows, noting you may have a different trigger action:
11. Execute the Flow to merge the targeted Microsoft Word documents into a single Microsoft Word document.