cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jan_mac
Helper III
Helper III

How to count the files inside a Sharepoint Library?

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.  

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

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

View solution in original post

6 REPLIES 6
v-albai-msft
Community Support
Community Support

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

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! 😊

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.

 

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

Hi @jan_mac ,

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

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

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,131)