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 / CSV File Merging Issue
Power Automate
Unanswered

CSV File Merging Issue

(0) ShareShare
ReportReport
Posted on by 15

Hey all,

 

I'm attempting to read multiple CSV files and combine them all into a single file. 
  
I'm doing this with a for each loop and merging %CurrentItem% and a list labeled for each file (which should create a datatable).

 

When I output the %CurrentItem% straight into a .csv file, it works just fine, but when I write the list to a .csv file, it only outputs the words "column one".

 

After looking at the list variables, I noticed that the merge was creating lists that are effectively layered. 

The top layer is "list of datatables"

And then the second layer is the actual datatable. *Image of what I mean*

 

So how do I either prevent the multiple layers, or how can I perform this task more simply to avoid the datatable merge issue? 

Level one.jpg

I have the same question (0)
  • DSB Profile Picture
    Microsoft Employee on at

    Hello - you can try the method posted below.  You essentially read from a list of .csv > create a temp file > add the headers > loop for each data table extracted from each csv and append to the temp file > read the temp file contents using the 'read from CSV file' action to read it back as a data table instead of text > save the CSV and delete the temp file.

    DSB_1-1652884856937.png

     

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Check out my solution here.  You can combine any number of excel files into one if they all have the same column set.

     

     

    sorry. Didn’t send a link. I will send it when I get back to my computer. 

     

    Best of luck!

  • ThatOieBoy Profile Picture
    15 on at

    Thanks for this. I have one issue with how this is functioning for me. 
    Some "cells" of the imported CSV files are empty. 
    Whenever this loads them, it doesn't recognize the blank space and moves the remaining data in that row over. 
    So I'm getting occasional rows that are off by one cell (shifted left). 
    Any suggestions on fixing that?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at
  • DSB Profile Picture
    Microsoft Employee on at

    You are welcome,  It's a little unusual in the sense that the blank cells should still be comma separated 'somedata,,somemoredata' where the middle cell in this case is blank.

     

    Anyhow, Michael's solution also works, but involves opening a bunch of excel files and requires another licensed app.  We also have a feature coming out soon which will allow you to create, read, filter, modify and join data table variables so this could also be a solution.  Its tentatively scheduled for this June release.

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

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 481

#2
11manish Profile Picture

11manish 278

#3
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

Last 30 days Overall leaderboard