web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow needs to only pro...
Power Automate
Answered

Flow needs to only process csv attachments, sends message if email contains other files but not csv

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a flow built that looks at the attachments in an email and if there is a csv file it saves the file and sends a copy to an sFTP.

 

However, sometimes in addition to the csv there will be image files. And sometimes there will only be image files. In the case where there are only image files I want to send an email out to a group to let them know there was no csv attached. 

 

But currently if I evaluate with the Yes No condition and say Yes process the file or No send an error message email the error message email always goes out when there are multiple files of csv and image. I need the email to only go out if the attachments were not csv.

 

I know I can create two flows to handle the entire situation but it seems like I should be able to do this with one, using an array. But when I tried that it errored out because I used the Attachment Name to ensure there was a csv.

 

How can I do this?Capture1.PNGCapture2.PNGCapture3.PNG

Categories:
  • tom_riha Profile Picture
    10,187 Most Valuable Professional on at

    Hello @Anonymous ,

    your condition will probably never be Yes, the 'contains' operator is designed for an array, if an array contains given value. In your case it seems you want to compare string (I guess the left side in your conditions is 'Attachments Name'), for which the operator 'ends with' will be better.

    image.png

    Also, the 'Apply to each' action will process all attachments in the email one by one. In case your email has 2x .png file and 1x .csv file, it'll check the 1st .png file and send an email (it's not .csv). It'll check the 2nd .png file and send an email (it's not .csv). It'll check the .csv file and upload all the files.

    To check if one of the attachments is .csv and process the whole email accordingly I'd add a boolean variable and one 'Apply to each' action dedicated only to searching for the .csv file. If the variable is set to true at the end of this 'Apply to each', then there's a .csv file in the attachment. If it's still false, send the email.

    image.png

     

  • Verified answer
    Paulie78 Profile Picture
    8,424 Moderator on at

    I would change approach slightly. Simply filter the array of attachments, before you loop through them to contain only CSV files.

     

    Here I sent myself a .csv and a .txt, but only the .csv remains in the filter array. You can then do a condition based on the length of the filter array and use that as a basis for the email to send or not. This would also be a bit faster.

     

    FilterAttachments.PNG

     

    Make sense? Using this method you never have to be concerned with the other non .csv attachments.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 335 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard