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 / Creating usable csv fi...
Power Automate
Answered

Creating usable csv file from Get Files list of objects

(0) ShareShare
ReportReport
Posted on by 4

Hello - new poster here - I have searched and tried different methods but nothing seems to be working.  Any guidance is appreciated.

 

We are going through a reorganization effort of a large volume of files on an internal server.

I have been successful at using the Get Files in Folder action which saves the list and its related information in variable %Files%.

 

I would like to output that list into a csv or excel file so we can distribute the list among our department to review the files for deletion, moving etc. In the end, I need a file (csv, excel , text) that has rows of data with the following columns:

FullName, Size, LastAccessed, LastModified, Directory - all of which are standard detail collected in the Get Files from Folder action.

 

When I write to csv file from %Files% it only gives me the FullName of the file, a comma, then next file name in line so excel thinks its hundred of columns instead of rows which makes it unusable in excel or even notepad.  I need to have a separate row for each filename (and its data).

 

When I tried creating a data table and adding a header row then doing an each loop to insert a row it does not seem to be adding each column (Name, Directory, Size).  I get an error that the row being added has fewer columns (1) than the datatable(15).

 

My loop is taking %DataTable% +[ CurrentItem.FullName, CurrentItem.Size, and so on]%

but it seems to either only be picking one column or combining them all into one column.

 

Any guidance is appreciated!

 

 

 

 

  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @RptMvn 

     

    Try thie flow design 

     

    Nived_Nambiar_0-1683435290130.png

     

    Step 1 : set a datatable variable with headers

    Nived_Nambiar_1-1683435327527.png

     

    Step 2:

    get files in folder 

    Nived_Nambiar_2-1683435361175.png

     

     

    Step 3: Loop tthrough each file in folder and append each file detail to the datatable (dt_final, in this eg) using set variable action like below

    Nived_Nambiar_3-1683435436370.png

     

     

    Step 4: outside the loop, use write to csv action to write the datatable to csv file.

    Nived_Nambiar_4-1683435488233.png

     

    Nived_Nambiar_5-1683435500305.png

     

     

    Hope this helps !

     

    Mark it as solution if it resolves your query !

     

     

     

     

     

  • RptMvn Profile Picture
    4 on at

    Thank you so much!  This worked brilliantly!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 213 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 151

Last 30 days Overall leaderboard