cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rwittels
Resolver I
Resolver I

Nested Apply to Each Loop

Hi. I am testing with a basic table called Learning Sessions:

 

rwittels_0-1663156129817.png

 

Thanks to this article (https://powerusers.microsoft.com/t5/Building-Flows/Get-distict-values-from-Excel-column/m-p/706475#M...)  I am able to get a list of distinct Title values into an Array called DistinctTitle.

 

rwittels_2-1663156784002.png

 

My challenge now is to iterate through the DistinctTitle array and find all matching records in the Title column and create a copy of the records in a new worksheet with the distinct Title name. I know that I need to do For Each on the Outputs of the Compose, which is the array and then do a nested For Each on the full worksheet wherever the DistinctTitle value is equal to the Title value and if true, copy to the new sheet. I will appreciate some guidance here.

 

rwittels_1-1663156342018.png

 

3 REPLIES 3
Caspar_Rubin
Solution Supplier
Solution Supplier

Hey, 

 

I hope I understood your Question correctly...

I made 3 Excel Files. I think you have more but I just made one for all data (Learning Sessions.xlsx) and then just two separate files named "Learning Session 1.xlsx" and "Learning Session 2.xlsx" for those Learning Sessions.

In your case, you would just have more of those files, right? 

The tables inside those three files are all the same layout and all are named the same: "LearningSessions".

 

Caspar_Rubin_1-1663160099249.png

 

Now, for the flow. This is the whole flow:

Caspar_Rubin_2-1663160167102.png

 

The nested Apply to each looks like this:

Caspar_Rubin_4-1663160274711.png

 

If I run the flow, the results in the Excel files looks like this:

 

Caspar_Rubin_5-1663160338922.png

 

is this what you wanted? Let me know if you need a better explanation on any of the steps in the flow...

 

cheers

 

 

 



 

Thanks for the response. Your answer does not help with creating new sheets in the same file but I will look at your suggestions and see if I can adapt them to my need.

rwittels
Resolver I
Resolver I

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,846)