Showing results for 
Search instead for 
Did you mean: 
Level 8

Group files and attach them to an email


This question is kind of related to my previous one but it goes beyond that.

The issue or question that I have is now the following. 

Let's say we have a list of documents on Sharepoint. 

File 1: ABC-001

File 2: ABC-009

File 3: ABC-095

File 4: DEF-077

File 5: DEF-098

The first 3 letters denote the customer to which I would like to send the email with the attached files. 

So, in my case, I would like to send 2 emails.

Email 1 to customer ABC and Email 2 to customer DEF. 

The emails should of course only have the respective files attached. 

Is such a grouping/selection of the files and attachment to an email feasible?

Best regards, 


Super User
Super User

Re: Group files and attach them to an email


Can you provide a little more detail.  For example, do you have a list of the file name prefixes you are looking for?  Is there a list somewhere of who the emails should go to for each type of file?  How many types of files will there be?  In SharePoint?  With that info, this is pretty straight forward.


Let me know and I'll provide an example.


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Dual Super User
Dual Super User

Re: Group files and attach them to an email

Hi @lreinhard7 


I built this specifically for your use case


This is how my SP list looks like - so I send emails to the EmailTo column 

You can modify the Flow based on your use case




Reza Dorrani


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Level 8

Re: Group files and attach them to an email

Hello Scott, 

Many thanks for your feedback. 

The files look always the same (below is a screenshot form our demo/test system)

1st element: Customer ID (e.g. DE-015, DE-016, etc.)

2nd element: @ symbol to separate customer ID and invoice number

3rd element: invoice number (e.g. FTI-000066)

Note that there are always 2 files; the first one is the XML with the invoice information, the second one is the PDF. 


I try to attach all XML and PDF documents for a specific customer into a single email and send it to them. 






Helpful resources


Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,702)