Showing results for 
Search instead for 
Did you mean: 

Using Microsoft Flow Arrays

In this post, we will discuss another approach for merging multiple documents into a single PDF using Microsoft Flow. In previous blog posts, we had a look at the Iterative approach and REST API approach to merge documents to PDF.

Both approaches have their own advantages and disadvantages:

  • For the iterative approach we merge one document at a time, as this results in multiple merge requests, the number of operations, and time taken, increases.
  • To overcome the limitation of the iterative approach we used the REST API approach, which combines all operations into a single request, and is not subject to Flow’s 100MB size limitation. However, this only works when the input and output files reside in SharePoint Online.

To overcome the above limitations Muhimbi has come up with an awesome new approach for merging documents to PDF using the recently introduced Microsoft Flow Array technique.


Before we begin. please make sure the following prerequisites are in place:

  • An Office 365 subscription with Flow and OneDrive for Business support.
  • Muhimbi PDF Converter Services Online full, free or trial subscription (Sign up).
  • Appropriate privileges to create Flows.
  • Working knowledge of Microsoft Flow.

Now that we have all the prerequisite in place let’s start building our Microsoft Flow.


In this blog post we will push all the files from a OneDrive for business folder into an array and then pass it to the Muhimbi Merge action, all in one go. Once all the files are merged, we will store the resulting file in a separate folder. Feel free to update the Flow and read the files from a different provider such as DropBox, SharePoint, Google Drive, etc.


So without wasting any more time let’s start building our Flow. From a high-level our Flow looks as follows:


Step 1: For this demo we will use the “When a file is created” OneDrive for Business Trigger. Naturally you can use other triggers as well, whatever is applicable to your scenario.

In the action, specify the path to the Folder to monitor for new files.



Step 2: Add the OneDrive for Business “List Files in folder” Action and specify the folder containing the files to merge.



Step 3: Initialise a variable of type Array and Name it ‘Files’.



Step 4: Add the ‘Apply to each’ loop and set it to the “value” field, output of the OneDrive for Business “List Files in folder” action.



Step 5: Add the “Get file content” action and pass the ‘Id’ value into the File field (Id of OneDrive for Business “List Files in folder” Action action) and set the “Infer Content Type” to ‘No’.



Step 6: Add the “Append to variable” action and specify the following values:

  • Name: Files
  • Value:
  "source_file_name": @{items('Apply_to_each')?['DisplayName']},
  "source_file_content": @{body('Get_file_content')['$content']}


Step 7: Outside the “Apply to each” loop add the Merge Action, click “Switch to detail inputs for array item” and pass the “Files” variable (the output of the ‘Append to array variable’ action).



Step 8: Add the OneDrive for Business “Create file“ Flow action and configure it with reference to screenshot below.

  • “Folder Path”: In this demo just hard code it to a path of your choice. Please make sure you don’t use the same path as the input file, or you will create an infinite loop.
  • “File Name”: For this demo lets just hard code it to “Merged.pdf”
  • “File Content”: Processed file content (output of Step 7).


That is all there is to it, save your flow and upload a file to the source folder. After a few seconds the merged file will / should show up in the specified output folder.


Subscribe to my blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Blog site: MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: and twitter I also write at, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – Youtube channel -