web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / check if file exists i...
Power Automate
Unanswered

check if file exists in SharePoint Library

(0) ShareShare
ReportReport
Posted on by 443

Hallo,

 

I have a recurrent flow that runs every day and reads 3 excel files uploaded in SP Doc Library.

 

I initialize the file names in 3 variables as they are fixed.

Then i use the Get tables excel connector. 

However if the file name is not found, the flow fails.

marial16_0-1650003426226.png

 

I use 3 parallel actions for Get Tables in order to get all 3 files. 

 

How can i make sure if there is any of the 3 files missing and  prevent flow from failing?

 

In the get tables *File i am building the Name of file:

concat('/subFolder/File Name PROMO ',variables('var_DATE'),'.XLSX')
Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,690 Moderator on at

    Hi there,

     

    You could use a "If fails" action. For example, even just a Compose (or an Email to notify you). 

    Right after your Get Tables action (the one that will fail), add in a Parallel Branch, then on one side add all of your normal actions - but on the other side, add Compose or Email, then, in that action, click on the ellipses, configure run after, and change the checkbox to "has failed". You will see the parallel action will turn to a red dashed line on one side.

     

    Here's a screenshot - ignore my random stuff on the left. Just showing the "successful" branch:

     

    Rhiassuring_0-1650093852694.png

     

     

    The flow still has a fail in it so it does show it as an error, but it's a controlled error - something you're acting on.  

    OR - is the preference to determine which of the 3 files is missing FIRST, and then notify you (maybe an approval task for update?) to fix it before it runs? 

    Cheers,

    Rhia


  • Verified answer
    GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on at

    Hi @marial16 ,

     

    in order to handle everything inside your flow and reacting to a non existing file, you can also use the connector „Get Files (properties only)“ and check the length of the answer like already mentioned here: https://powerusers.microsoft.com/t5/General-Power-Automate/How-to-check-if-a-file-exists-in-a-SharePoint-library-by-file/td-p/338207 

     

    As the answer is already three years old, I double checked it today and it still valid:

     

    GeorgiosG_0-1650115013169.png

    Note: Make sure to use the length of the value and not the body:

     

    length(outputs('Get_files_(properties_only)')?['body/value'])
  • Jv_Roccon Profile Picture
    9 on at

    Hi GeorgiosG,

    I tried it in my case, but even when the file is founded the value is blank. Do you know how can I repair it?

  • Stinow Profile Picture
    13 on at

    The array called 'value'? Maybe you can check the trigger; often if it starts after a file is uploaded, the file can still be uploading and you'd need a Delay action. 

    Could you elaborate what you mean with value is blank?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard