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.

ErwanF
Frequent Visitor

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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,465)