Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Merging Varying Numbers of PDFs from Sharepoint Folder


I have a setup where there is a sharepoint folder in which several PDFs get saved throughout the day. At the end of the day, the PDFs are moved from this folder to an archive folder so that the folder is empty again for the next day.

I would like to create a scheduled flow that merges all of the PDFs from the folder into one file before they are moved. I understand how to use Adobe PDF Tools' "Merge PDFs" action when entering in each specific file, like in the first screenshot below. The issue I face is that there won't be the same number of PDFs to merge each day. Some days will be four-or-five and others could be upwards of twenty. 


I am looking for a way to instead use actions:

  • List Files in the Sharepoint Folder
  • Initialize Variable (array)
  • Apply to Each - Add each file content to variable in correct format
  • Input entire array variable in the Merge PDFs file content like in second screenshot.

I'm not even sure if this is possible, but would love any advice for this that's out there.





Thanks in advance.

Super User
Super User


You can create an array variable after the trigger and use this to store the file content, once you have the variable initialized you can add the append to array variable action after the "Get file content" step.


Format the array in the append to array variable step as below



pass this variable into the Merge PDF step and it will resolve the issue.



if the information shared helps you, please consider giving a thumbs up 👍 and mark solution as resolved

This seems to be very close but I can't quite get it to work. 

Here is my flow, and the error it produces:




*Note I removed the quotes around 'File Content' as it seemed to like that more, based on viewing the inputs after the flow has run.

Here is the error that the flow produces: 




The SP folder has only two files in it, so I re-created this flow using the individual file content option on the PDF Merge step in order to compare the raw inputs:


This flow of course works fine. I've copied and pasted the raw inputs for the Merge PDFs step from each flow and noticed this difference:

Individual PDF Merge (raw input):



PDF Merge all as Array (raw input):



I've spot checked a ton of the code from these two inputs and everything appears to be identical with the exception of that highlighted part with the field name. I've also removed the "Name" field from the JSON in 'Append to Array Variable' step but end up with the same issue. It seems to be that it doesn't want the "Content:" field name before the actual content, but removing the field name prevents it from being in JSON format. 

Any idea what I might be doing wrong or any tweaks that can get me over the finish line?

Helpful resources

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (106,009)