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 / Is there a simple way ...
Power Automate
Unanswered

Is there a simple way to loop through files in a sharepoint folder

(1) ShareShare
ReportReport
Posted on by 6
Hello everyone, basically I want to loop through a sharepoint folder with csv files, and if the file name contains a keyword, pick that file and count the number of rows in the file. Is there an easy way to do this? I cant find much online, thanks!
Categories:
I have the same question (0)
  • Verified answer
    leo85 Profile Picture
    609 on at
    Hi,
    is your problem to loop through the SharePoint list or through the file?
     
    To loop through the list you do the following steps:
    1. Create an action "Get files (properties only)" from the SharePoint Connector
    2. Create a "Apply to each" loop.
    3. Add the "body/value" attribute from the "Get files" action to the input of the loop.
     
    If you want to count the number of rows in a csv file. This is not trivial, but you could try the following.
    1. Create an action "Get file content" form the SharePoitn connector.
    2. Create a "Compose" action with the following expression "split(body('Get_file_content'),decodeUriComponent('%0A'))". This splits the content of the file at every new line.
    3. Create another "Compose" action with the following expression "length(outputs('Compose'))". This counts the number of items in the array created by the action before.
    The number of rows in the CSV file should be in the last compose action.
     
    Regards
    -----------------------------------
    If my answer solved your issue, please mark it as a solution.
    If what I wrote helped you, please give it a thumbs up.

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 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard