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 / Unable to merge two cs...
Power Automate
Unanswered

Unable to merge two csv files using Powerautomate flows

(0) ShareShare
ReportReport
Posted on by 5

Hi All,

 

The requirement is to send a combined csv file as an attachment with common field/columns from two different entities. Using List rows action & create csv table, I am able to achieve two csv files for each. 

I want to merge and send the combined csv files as a single attachment.

 

Any help is much appreciated.

 

Regards,

Hemanth DR

Categories:
I have the same question (0)
  • srduval Profile Picture
    1,760 Moderator on at

    Check out this post. I think what you're after is trying to merge two arrays (list rows) and include the values from one file where a key column matches the other file:

    Solved: Re: how to merge two arrays - Power Platform Community (microsoft.com)

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    It is quite easy to do. The main complication is that the "Create CSV Table" action helpfully includes a header row. If you join the output of two of these actions you will have a extra header row where the second CSV file begins. So I would do something like this:

    CombineCSV.png

    First, the two separate CSV files are created.

     

    Then there is a compose action which splits the output of the second CSV on a line break to turn it into an array. The first element of that array is skipped and then the array is turned back into a string but without the header row. The expression used for this is:

    join(skip(split(body('Create_CSV_table_2'), decodeUriComponent('%0A')), 1), decodeUriComponent('%0A'))

     

    Then the two string outputs of the original CSV and the RemoveHeaderFromCSV2 actions are combined in a final compose action with the expression:

    concat(body('Create_CSV_table'),outputs('RemoveHeaderFromCSV2'))

     

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a solution 😘

     

  • srduval Profile Picture
    1,760 Moderator on at

    I believe the intent is to merge AKA join the two tables, not union them

  • Paulie78 Profile Picture
    8,422 Moderator on at

    It is difficult to be sure. But I read the original post to mean that he is already able to successfully generate two CSV files. He just wants them to be a single CSV file. Perhaps the original poster will clarify.

  • HemanthDR Profile Picture
    5 on at

    Thank You @Paulie78 , I am now able to Merge two CSV files.

     

    Thanks @srduval .

  • navathad Profile Picture
    on at

    Hi There, Please help me with any ideas here, can this be implemented with Export To File from Paginated Reports in Power Automate(Other than using Power Automate Desktop to create flow and then scheudling in Power Automate);  I'm trying to merge 2 CSV Files( as it gives error for file size limitation to Create File to get the whole data in a single file). Also, Append overwrites the data in the file. Any suggestions would be helpful. Thank you.

    navathad_0-1666589091022.png

     

    navathad_1-1666589190286.png

     

  • Rana1 Profile Picture
    21 on at

    Thanks @Paulie78 , Saved my day . Exactly what I was looking for. Wanted to append one Create CSV output to another and your solution worked like a charm.

  • GregHM Profile Picture
    2 on at

    Hi @Paulie78 , this is a brilliant solution, how would you then concat a 3rd table to the results of the first 2? I have tried unsuccessfully so far

  • srduval Profile Picture
    1,760 Moderator on at

    repeat his steps for the second compose, (skiping file header etc), then either do a concat(concat( or setup an additional compose and do concat(outputoffirstconcat,third file contents)

  • Rishicfdi Profile Picture
    12 on at

    This is a very efficient solution. 

    However, I am trying to merge multiple (undecided, depending on Dataverse Table size) Create CSV table actions based on a loop. Any ideas to keep concatenating result of the latest one to the previously concatenated ones?
    I saw the advise for three files, however I will have anywhere between 3- 7 Create a CSV actions out of which one will be preliminary and others in a Do until loop. (I am using Skip Token to list rows dataverse table)

    Thanks

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard