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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply to each problem:...
Power Automate
Answered

Apply to each problem: Scheduled flow adds all attachments instead of per selected line

(0) ShareShare
ReportReport
Posted on by 90
I am building a scheduled flow that sends exam preparation assignments 14 to the student before the exam. I get the exam date from an Excel file, the date correction is done in Initialize var Date. So far so good.
Now I disappear in different Apply to each actions which leads to:
- an email is sent to each filtered line (that is ok)
- with all the different attachments (that is not ok, should only be the attachment from that one line)
- those attachments (pdfs) cannot be opened either.
All (very many) suggestions on the forum do not lead to a solution.
Where does this go wrong?
In a previously built flow with the trigger "For a selected row" the Get files (prop only) was not put in an Apply to each. What makes the difference here?
 
 
Categories:
I have the same question (0)
  • Suggested answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    You need to restrict your Get files action to only return files for a specific item.
    You need a filter clause like
    ID eq 'ID of the item'
  • chosen67 Profile Picture
    90 on at
    Thnx @SudeepGhatakNZ for your help,
     
    The filter query used is: Attachment (=Attechment) eq 'Attachment'. Even if I use Id eq 'Id' this results in an Apply to each.
    From the List row present in a table action (as output of the Exam Date filter) 4 rows from Excel come with all the data in them; including indeed the different Attachments per student.
     
    In another flow with the trigger "For a selected row" I used:
    = triggerBody()?['entity']?['Attachment_Formatted'] =
    and this returns concerning Attachment
    In my flow I now have no option to choose Attachment_Formatted as dynamic content.
     
    I can't figure out how I can now, just like in the "For a selected row", get the specific data (Get files (property only)) that yields the correct attachment per sent email.
  • chosen67 Profile Picture
    90 on at
     
    In the meantime I have continued to puzzle, but have not made any progress yet:/
    Filter query in List rows present in a table is still Exam Date. With that I get 2 lines of Excel as output.
    The emails must then only be sent to those students who need the preparation assignment for a specific exam. So another filter is needed. I did that with a Filter array (in this case it can be filtered on the text "sprek", but it would be better if it were filtered on cells that contain something, but I don't know how to do that)
     
     
     
    The output from my filter yields 1 row (which is correct), but now the content of that row must provide 2 things: the email address in combination with the attachment that must be sent. In any case, the output provides the correct data from the selected line in Excel, including the name of the attachment to be sent
     
     
    How do I get that from the Filter array? That doesn't seem to be possible with Select. (see picture below) Because if I then choose Email again, it can only be from the Excel file that has not yet been fully filtered.
     
  • Verified answer
    chosen67 Profile Picture
    90 on at
    In the meantime, we have made a lot of progress with the help of this forum and YouTube. The following adjustments have been made:
    After the "List rows present in a table" I have now placed a "Condition" in the "Apply to each" that checks whether there is anything in the Attachment column. That produces the correct output.

    I then created another Condition in which the Attachment names in Excel and in Sharepoint are compared. If the same: send an email with attachments.
    This does produce 22 actions (22 different attachments in Sharepoint) per email to be sent. I suspect that this could be shorter? Suggestions?
     
    In addition, there is a 'problem' with the PDF extension: the attachment in the email is not presented as a PDF. It can be opened as such with the correct content. If I change the name to xxx.pdf.pdf, the attachment is recognized as a PDF. Could this be a Sharepoint setting? It seems that the extension is not really in the name on SP, but that it is added to it?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 378 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 305 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 155 Most Valuable Professional

Last 30 days Overall leaderboard