How to Create a Basic Zip Archive in Power Automate
When we go about creating a new zip archive, we typically right click & select the option to zip a group of files within a certain folder (or simply zip the entire folder). In those cases, we’re taking advantage of the fact that the files we need are conveniently stored in one location.
Things get more complicated and less efficient, however, when we begin assembling zip archives with files stored in different locations. Rather than track down & consolidate the files we need manually, we should instead take advantage of a central integration platform with access to all of our applications.
Create a Zip Archive in Power Automate
In Power Automate, we can assemble zip archives with ease using the Cloudmersive File Processing connector. We can, for example, build a reusable “button” (instant cloud flow) that zips any number of different files together based on manually selected file paths.
In this article, we’ll build an example instant cloud flow that gives users the ability to zip 10 files from our system into a single archive. We’ll then email that archive to the user directly at the end of our flow.
We’ll begin by opening our Manual trigger and adding several inputs. The Cloudmersive File Processing action we’ll eventually use allows up to 10 file inputs, so we’ll add 10 file inputs in our manual trigger step. We’ll include one email input at the end so users can provide the email address the zip archive will be sent to.
Next, we’ll add a new action in our flow and search for Cloudmersive connectors. We’re looking for the Cloudmersive File Processing connector, which has a purple logo.
To view the entire actions list, we’ll click “See more”. From there, we’ll search for an action called Compress files to create a new zip archive. We’ll notice we have several other zip archive options on this actions list, and we can explore those if we want to (we’ll cover some of them in future blog posts).
After we select this action, it’ll be time to create our Cloudmersive File Processing connection. If we’re new to using Cloudmersive connectors, we’ll need the following to create our connection:
- A premium Power Automate license (Cloudmersive connectors are third party; premium licenses are required to access most third-party connectors)
- A Cloudmersive API key (free API keys can be obtained by creating a free account on the Cloudmersive website; they allow a limit of 800 API calls per month and zero additional commitments)
Once we’ve created our connection, we’ll begin filling out our request parameters. We’ll start by adding the file bytes and file name of our first manual file input (for reference — we don’t actually need our file’s real name for this action to work correctly).
Next, we’ll click “Show all” to view the Advanced parameters, which contains the remaining file input fields. We’ll enter the rest of our manual file input information in each of these fields. Note that this action does NOT allow null inputs; if a file is not included in one of our manual triggers, the flow will not run.
Now we’ll add an email action into our flow, and we’ll share the zip archive with the email entered by the flow user. In my example, I’ll be using the Send an email (V2) action from the Office 365 Outlook connector.
We’ll add our flow user email address in the To field (note that we’ll need to switch to Advanced mode to use dynamic content here), and we’ll make the Subject and Body whatever we want (if we want, we can also allow the user to fill text fields in the manual trigger step to satisfy these additional email parameters).
After that, we’ll click “Show all” to view the Advanced parameters, and we’ll click Add new item within the Attachments parameter. This allows us to pass file bytes from our Compress files action and give the new archive any name we want.
Now we’ll save and test our flow. To run our test, we’ll select 10 or files from our system to compress.
We’ll find an email in our inbox with our new zip archive attached.
And that’s all there is to it! Now we can easily create a flow for zipping between 2 and 10 files at a time.