Convert Email Attachments to PDF Using Power Automate

In this guide, you’ll learn how to automatically convert all email attachments to PDF and archive them to your desired file service using Power Automate and Muhimbi PDF Connector. For this example, the flow is triggered when an email containing attachments is received in Office 365 Outlook. The flow then iterates over all the attachments and converts the ones it knows how to convert to PDF. The resulting PDF files are archived to a OneDrive for Business folder, which will sync the files to other systems if needed.

It’s also important to note that this example can easily be modified to use different email providers (e.g., Gmail) and the converted attachments can be written or emailed to any of the 100+ available flow services, including Google Drive,, Dropbox, OneDrive, and SharePoint.

The Workflow

From a high level, the flow works as shown below.

PDF Attachments - Overview

The full flow can be found further down. You can automatically create this using the Archive email attachments in PDF format to OneDrive flow template.

Once you have this template, you need to fill out the following:

  • Save to OneDrive > Folder path — Specify the path in OneDrive where the converted attachments will be written to.

In this particular example, all files are written to a flat folder. If you were to use the original attachment file name to save the PDF in OneDrive, the files would potentially be overwritten. This could happen if a single email has multiple attachments with the same name, or if multiple emails are processed and some use an attachment with the same name.

A workaround for this is the Compose action, which is used to convert the time that the workflow is executed. This matches the time the email is received, and it cleans it up for use in file names (by replacing : with -). Then, you concatenate it to each file name. If your requirements are different, feel free to change this or add the timestamp to the OneDrive path to automatically create a subfolder for each email and its attachments.

PDF Attachments - Detail - Part1

PDF Attachments - Detail - Part2

One of the tricks in this example is changing the default Fail on error option in the Muhimbi workflow actions from Yes to No. As a result, the flow won’t fail if an unsupported or broken attachment type is encountered. By evaluating the Result code, you can decide if the operation was successful and write the PDF to OneDrive. For more details about this concept, refer to the Error Handling section in our core concepts Knowledge Base article.

You can now publish the flow and send an email containing MS Word, MS Excel, MS PowerPoint, or other supported files types to the email address associated with the flow. After a few seconds, a PDF will appear in the destination folder.

For more details about using Muhimbi’s flow actions, refer to the core concepts Knowledge Base article, as well as all other flow-related posts.

Additional Resources

For more information, refer to the following resources.

Power Automate Templates


Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2024
This website uses cookies to ensure you get the best experience. Learn more