We quickly cover how to filter incoming emails based on whether a subject line contains a phrase or if you need more advanced filtering options that what is readily available in the Outlook email tools in Microsoft Power Automate Flows.
Using Power Automate Flows to Save Email Attachments
One of the best use cases for Power Automate Flows is the ability to automatically detect incoming emails into a personal or shared e-mail inbox and save it to a cloud service like Microsoft OneDrive or SharePoint.
It’s one of the fastest workarounds for consolidating reports. Some systems are much easier to schedule a routine email from than they are to connect to with SQL or an API. Automating the sending of an e-mail to a shared folder and saving it to a cloud service sets you up to consolidate the reports in business intelligence software like Power BI for automated reporting.
How to Setup Power Automate Flows to Save E-mails
By far the fastest way to setup a workflow is go to the Power Automate Website, You can pay for the service, or it’s include in most enterprise grade Microsoft Office 365 license.
Create a new workflow, and select Describe it to Design it. This feature allows you to use natural language processing to describe a process and it will automatically generate the steps for you. It’s not 100% accurate but makes for a quick starting point.
You can also manually create a Power Automate flow using a few simple steps. We walk through them below.
Subject Filter on Works for Exact Text
Using the When a New Email Arrives trigger will allow you to define which e-mail address the workflow is looking at, There is a button at the bottom to Show Advanced Options.
Under Advanced Options, you can filter for specific e-mails that include attachments, or have a specific Subject Filter.
Note: The Subject Filter looks for the full exact text string only. You cannot use this to check for whether a string contains a specific word or set of words.
Filter Emails in Power Automate for Contains Using Condition Controls
A better way to setup filtering in Power Automate Flows is to use a Condition Controls.
Controls are a way for Power Automate to check whether a specific true or false criteria has been met. If a criteria is True then it will proceed with the green set of the workflow. If it’s false, then it goes to the red.
In the example below, we added a Control,
You can do this manually by following theses steps:
- Click the Plus button at the bottom of the When a New Email Arrives step
- Click Add an Action
- Choose the Control Step and the Condition Action on the next step
- This gives you the ability to add more granular criteria, such as contains.
We used Subject as the Value from the Dynamic Content Selection dropdown. Dynamic Content will allow you to reference fields that have been brought into your workflow in previous steps.
Filtering Power Automate Flows on Multiple Criteria
The Control Condition step is highly flexible. If you need to create more dynamic filters, you can click the + Add button at the bottom. This allows you to insert a new row of criteria.
At the top of the Condition, you can toggle between AND / OR with the rows selected become the multiple accepted values in the statement.
Setting up the True and False Workflow Paths
Most of the times when setting up a simple Power Automate Flow to save files, you will check to ensure that criteria is met. Then if it is met, you will continue to the If Yes (Green) section of the workflow.
Note: It is okay to leave the If No (Red) section blank. This will automatically terminate the workflow.
The last step for our workflow is to Create a File in SharePoint. This could be OneDrive or whatever service of your choice.
While working with Power Automate Flows to save attachment it’s important to remember 2 things.
- Include a File Extension in the File Name Field – Without a file extension, Windows will either be unable to open the file or it will incorrectly guess the file type and give you an error or will open a blank file.
- File Content should be the Attachment Contents – File Content and File Names are two separate pieces of data for Power Automate. The File Content does not need an extension, it will usually be a dynamic content block from earlier in the workflow.
Note: This screenshot leaves the SharePoint directory blank, you would need to navigate to a site or specific folder path. This same technique should work to save files to OneDrive or other Cloud Services.
Pop! Automation is Here to Help
Contact us today If you need help automating your business, payroll, or accounting processes. Pop! Automation specializes in helping companies achieve more using tools that are widely accessible like Microsoft Power Automate and Power BI.
We also offer training courses from beginner to advanced to help your team build transformative solutions on their own. Contact us today!