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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / List Files in Folder i...
Power Automate
Unanswered

List Files in Folder in Excel

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I'm trying to make a flow that will look at a folder and list all on those files into an Excel sheet. My flow does this but I would like it to show the file name not the file path. I am trying a 'For Each' but am receiving an error. How can I make this work?

kirabray_0-1671133871500.png

 

  • VJR Profile Picture
    7,635 on at

    Hi @Anonymous 

    Hope you are using the CurrentItem in the Get file path part.

    If still not working please share a screenshot of this action.

    VJR_0-1671157626186.png

     

    From the list of toggle buttons shown above enable/disable based on your requirements.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    If you really want to use for each, then open excel and just write %CurrentItem.Name% or %CurrentItem.NameWithoutExtension% directly to the cells. For instance, if you are putting them in column A…

    set variable index=2 (assuming starting row 2)

    launch excel

    for each

        Write to excel in column A and row %index%
        set variable %index% to %index+1%
    end for each

     

    however, there is a much faster way to do this. 

    Run CMD for the folder you used in Get Files

    write to cmd:  dir /b | clip ‘this copies all filenames in the current directory to the clipboard. 
    Launch excel

    activate the proper cell

    paste from clipboard

    ’should be done

        

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 389

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard