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 Apps / How to count the files...
Power Apps
Unanswered

How to count the files inside a Sharepoint Library?

(0) ShareShare
ReportReport
Posted on by 106

Good day people I would like to ask some help. I have a gallery that filters a folder (logistics) in a sharepoint Library. Inside Logistics are four more subfolder. Subfolder 1,2,3, and 4 each subfolder contains multiple files, how do I count the number of files in each subfolder and display it beside the subfolders? Thank you for your help.  

Categories:
I have the same question (0)
  • Verified answer
    v-albai-msft Profile Picture
    on at

    Hi @jan_mac ,

    I done a test on my side, you can refer to my steps.

    Here is my library called library1 with two folders:

    valbaimsft_0-1628673711867.png

    Inside folder Logistics, there are four subfolders(folder sub1 has one file, folder sub2 has 2 files, folder sub3 has 3 files and folder sub4 has 4 files):

    valbaimsft_1-1628673767995.png

    In my app, I have a Gallery that displays all subfolders inside folder Logistics:

    Filter(library1,IsFolder = true &&'Folder path'="library1/Logistics/")

    valbaimsft_4-1628674230789.png

    In this gallery, beside each subfloder, there is a label to show the file count of each subfolder:

    CountRows(Filter(library1,'Folder path'="library1/Logistics" &"/"& ThisItem.Name &"/"))

    valbaimsft_5-1628674396231.png

    Best regards,

    Allen

  • jan_mac Profile Picture
    106 on at

    Thank you so much!! You even put the effort of creating a Sharepoint library and named the folders same to mine. Many blessings to you and your family! 😊

  • ErwanF Profile Picture
    94 on at

    Hi @v-albai-msft

    I cant seem to apply these code to my gallery. Instead of showing the numbers of file, it shows number of folder.

    ErwanF_0-1655116978010.png

    Using the below return null value instead.

    CountRows(Filter(Documents, !IsFolder = true && 'Folder path'="Shared Documents/Test1/"))

    ErwanF_2-1655117008930.png

     

    Is there any work around for this? I've running out of brain power trying to fix this.

     

    Thanks in advance.

     

  • jan_mac Profile Picture
    106 on at

    Try adding "& ThisItem.NameOfColumn" at the end of the formula.

  • ErwanF Profile Picture
    94 on at

    Hi @jan_mac ,

    Will try that later. Theres problem in connecting to powerapp make today. 

  • jRufus Profile Picture
    57 on at

    This is a fine solution but non delegable so, don't use it if your document library has more than 500 items (or 2000 if you don't mind your app to run slow).

    Josu

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard