cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
barney1234
Regular Visitor

how to get file name and compare it to excel sheet name

hi everybody. i am really new to this world. i want to create a flow that when i add a file name to a folder.

it will get the file name, compare the file name to an excel worksheet and check if they match. if they don't, it I will create a new excel sheet by the file name.

1 ACCEPTED SOLUTION

Accepted Solutions
eric-cheng
Solution Sage
Solution Sage

Hi @barney1234 ,

 

Try the below flow.

 

1) Use a when a file is created in a folder trigger and then get metadata

 

ericcheng_0-1627908798964.png

2) Initialize a Boolean variable and set it to @false.  Add a Get worksheets action to get all the worksheets in your Excel

ericcheng_1-1627908884215.png

3) Loop through each Excel worksheet and add a condition where Name of worksheet is equal to Name of file (from Get File Metadata).  If found, set Boolean variable to @true

ericcheng_2-1627908980115.png

 

 

 

 

4) Exit the loop.  Add another condition to check whether your Boolean is false (i.e. it did not find a worksheet with the same name).  If true, create a worksheet with the name of the file (from Get File Metadata).

ericcheng_3-1627909076982.png

ericcheng_4-1627909101467.png

 

 

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

 

 

 

View solution in original post

1 REPLY 1
eric-cheng
Solution Sage
Solution Sage

Hi @barney1234 ,

 

Try the below flow.

 

1) Use a when a file is created in a folder trigger and then get metadata

 

ericcheng_0-1627908798964.png

2) Initialize a Boolean variable and set it to @false.  Add a Get worksheets action to get all the worksheets in your Excel

ericcheng_1-1627908884215.png

3) Loop through each Excel worksheet and add a condition where Name of worksheet is equal to Name of file (from Get File Metadata).  If found, set Boolean variable to @true

ericcheng_2-1627908980115.png

 

 

 

 

4) Exit the loop.  Add another condition to check whether your Boolean is false (i.e. it did not find a worksheet with the same name).  If true, create a worksheet with the name of the file (from Get File Metadata).

ericcheng_3-1627909076982.png

ericcheng_4-1627909101467.png

 

 

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

 

 

 

Helpful resources

Announcements
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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,436)