Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

Trying to find existing folders

To begin, I have two different excel spreadsheets, one used to make folders and the other used to upload into the newly created folders. The spreadsheet used to create the folders is named CFGSchedule and I am creating folders based upon the values in a column within the spreadsheet. The name for these folders are also those values. Once these folders are created I upload the second spreadsheet, Lineup Template, inside the new folders. 


The issue is that I want to create folders only when there isn't an already existing folder. I am trying to implement the idea from the link below but it seems like I can't do it with an 'Apply to Each' action. What should I do? Also, I am completely new to this.



Thanks for any help given.


Accepted Solutions
Dual Super User
Dual Super User

@alopez222 you just have to initialize a variable outside the loop and then set variable in the loop

View solution in original post

Dual Super User
Dual Super User

@alopez222 you cannot initialize a variable in the loop but you can use it in the loop, just move that action out of the loop and try again it should work.

Even the link you are referring has not initialized a variable in the loop so not sure why and how you did that 


If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.


From what I understand, the variable that produces the error is checking the folder name. In my case the folder name is equal to the varying values of the Project column in the excel spreadsheet. The name of the folders will be the values seen in the picture below. But one of the issues I have is that there are some repeating values which is why I am trying to create something that will prevent creating duplicate folders. Having said that, from what I understand, in the link they are setting the variable to a folder name already. How can I do this when I want to check different folder names?





Dual Super User
Dual Super User

@alopez222 you just have to initialize a variable outside the loop and then set variable in the loop

I'm completely new to this but I think I did what you suggested. I tested it and got this. It says the flow ran successfully.

Your suggestion:







Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,460)