Merge Documents using Muhimbi FLOW action..

I have been working a lot with PowerAPP and Flow 💡 with Muhimbi Actions in my recent weeks. This is my second Blog for Muhimbi.

In this Blog Post we will build a FLOW which will Loop though all the documents once a day in a OneDrive for Business Folder, Merge them and Create the Merged file in a different Folder.

Before we start building the FLOW, Let’s have a look at Final FLOW.

MergedOverview

Does the above FLOW screen-shot look complicated? Don’t worry. For the sake of simplicity. I have broken the FLOW into two parts and will explain each and every step in details.

So without wasting time let’s get into the Meat and Potatoes.😀

Part 1:

Merge FLOW Part 1

Step 1: “Recurrence” The FLOW will run once a day.

Step 2: “Initialize variable” Flow action to store the Merged Contents of

Type: “String”

Initial value: Null

Step 3:  “Initialize variable” Flow action to store the Merged Count

Type: “Integer”

Initial Value: Null

Step 4: Add the OneDrive for Business “List Files in folder” Action on the Folder library for which contain all the files that we need to be Merged.

Part 2:

Merge FLOW Part 2

Step 5:Add the “Apply to Each Loop” after Step 4 and add the Output(value) of “List Files in folder” (Step 4)

Loop

Step 6: This step will skip any sub-folder and will only select the files.

Merge FLOW Step 6

  • Add a condition.
  • IsFolder is the Output of “List Files in folder” (Step 4) and you need to set it to “False”.

Step 7: Now if the Step 6(above step) evaluates to True.

  • Add the action “Get file Content using Path”
  • File Path : Path is the  Output of “List Files in folder” (Step 4)

Merge FLOW Step 7

Step 8:

  • Add a condition.
  • Merge Count is the Output of “Initialize variable – Merge Count” (Step 3).

Merge FLOW Step 8

Step 9:Now if the Step 8(above step) evaluates to True.

Add Muhimbi “Convert Document Action”

The Action has two parameters

  • Source File Name: Name is the  Output of “List Files in folder” (Step 4)
  • Source File Content: File Content is the Output of “Get file Content using Path” (Step 7).

Merge FLOW Step 9

Step 10: Add the OneDrive for Business “Create File” action, under Step 9

The Action has three main parameters

  • Folder Path: The Path of your destination Folder.
  • File name: You can create a  variable for File name but for Simplicity I have hardcode it “MergedFile.PDF”.
  • File Content: “Processed File Content” Output of “Convert Document” Action(Step 9).

Merge FLOW Step 10

Step 11: Now if the Step 8(above step) evaluates to False i.e. Merge Count is now not equal to 0. 

  • Add the action “Get file Content using Path”
  • File Path : For simplicity Hardcode the Path with reference to Step 10. i.e.“/MergedSource/MergeDestination/MergedFile.pdf”

Merge FLOW Step 11

Step 12:  Now this is where the real Magic happens.

  • Add the Muhimbi “Merge documents” Action.
  • The Action has the following two main Parameters “Source File name” and “Source File Content”

Now let’s, configure this action.

  • “Source File name -1”: Hardcode the File Name “MergedFile.pdf” This file name should be same as Step 10 and 11″.
  •  “Source File Content -1”: File Content is the output of “Get file Content using Path 2”  Step 11.
  • “Source File name -2”: Name is the Output of “List Files in folder” (Step 4).
  • “Source File Content -2”: File Content is the output of “Get file Content using Path ”  Step 8.

Merge FLOW Step 12

Step 13:Add the OneDrive for Business “Create File” action, under Step 12

The Action has three main parameters

  • Folder Path: The Path of your destination Folder.
  • File name: You can create a  variable for File name but for Simplicity I have hardcode it “MergedFile.PDF”.
  • File Content: “Processed File Content” Output of “Merge Document” Action(Step 12).

Merge FLOW Step 13.png

Step 14: Add the Set Variable Action outside the Condition.
The Action has two main parameters.

  • Name: Select the “Merged Count” variable Initialized on Step 2
  • Value: Set the Value 1

Merge FLOW Step 14.png

Now, for Testing Purposes you can set the “Recurrence” Frequency to “Minute”. This will trigger the Flow after a Minute and Merge the document.

Merge FLOW Step 15

But Remember ❗to set the Frequency to “Day”, you don’t want to exhaust all you Muhimbi Conversion.

The Size of the Merged PDF file too large? Do not worry… Just  follow the blog Optimizing/Reducing the size of PDF files..

Happy Converting….

7 thoughts on “Merge Documents using Muhimbi FLOW action..

  1. Step 12 needs to be updated, you have “Source File name -1 & Source File Content -2″ twice. IT should read “Source File name -1 & Source File Content -1″ first and then “Source File name -2 & Source File Content -2”

    Like

Leave a comment