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

 

 

 

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Users online (1,617)