Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Need to combine CSV files so one becomes the Header

(0) ShareShare
ReportReport
Posted on by

We found an issue in QA; I need to add the first row (Row #1) of a CSV file to an already existing CSV file.

 
 

 

 

The first row looks something like this:
05, ,2021-01-25, ,BMECOL, ,750

How can I insert this as the first row to my already existing CSV file? It must be on the first row. I have googled until my fingers hurt :-). This is urgent to us. Thanks as always!
Mike Kiser

  • Community Power Platform Member Profile Picture
    on at
    Re: Need to combine CSV files so one becomes the Header

    BTW Your Blogs are very interesting!.....

  • Community Power Platform Member Profile Picture
    on at
    Re: Need to combine CSV files so one becomes the Header

    Thanks so much @DamoBird365 ! Now I understand completely; I did locate yesterday that I have so many fields I am bringing back from the DB that it is causing it to do a line break. So I am going to see from the Users if there are any fields I can drop. Your solution on the returns should help me out immensely also. Again, I really appreciate your time and also again, I love this Community! It is better than any Azure Data Factory or any other Community that I am a member of!  Mike

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Need to combine CSV files so one becomes the Header

    Hi @Anonymous 

     

    Did you sort it?  I am not sure why you would be getting return lines but you could experiment with the following:

     

    DamoBird365_2-1617256242431.png

     

    DamoBird365_3-1617256272969.png

     

    Damien

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Need to combine CSV files so one becomes the Header

    Thanks again...I am trying to understand what you are suggesting....can you please explain a little further (I am an Azure Data Factory guy and have not done much Logic App, but the ADF can not do this type of thing that Logic Apps can do)...thanks so much! We are almost there...Mike

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Need to combine CSV files so one becomes the Header

    You can do that with a replace expression but ideally you want to find out why/where in the history.

     

    If you create a compose and hit return, you can then use the replace on the string where the string to replace is the compose (i.e. the return line - by hitting return).  No need to encode/decode /r/n.

     

    Damien

  • Community Power Platform Member Profile Picture
    on at
    Re: Need to combine CSV files so one becomes the Header

    Hi @DamoBird365 , very sorry for the confusion...that one didn't work...I love the versioning on Logic Apps (ADF doesn't have it and I wish they did) this is the one that is correct but giving an extra /r/n between lines....any suggestions? If I could just remove one of the /r or /n, it might be correct..

    Thanks again! MIke

     

    ewinkiser_0-1617202847891.png

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Need to combine CSV files so one becomes the Header

    Hi @Anonymous 

     

    Your last solution looks a bit odd.  It's OK to get both blobs in parallel but then the update should be after both of these actions.  You had previously posted this order.

     

    Damien

  • Community Power Platform Member Profile Picture
    on at
    Re: Need to combine CSV files so one becomes the Header

    I meant to add this  @DamoBird365 

    ewinkiser_2-1617201947587.png

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Need to combine CSV files so one becomes the Header

    Hi @Anonymous 

    You need to look back at the history.  Is this already present in the original file(s) or are you seeing this only as a result of the merge?

     

    Damien

  • Community Power Platform Member Profile Picture
    on at
    Re: Need to combine CSV files so one becomes the Header

    Good morning @DamoBird365 , it is looking close now, but for some reason it is putting a /r/n (an extra blank line) in between the items. Do you know how I can get those out? It is what is causing the space between the lines which our QA won't accept. Do you know of a quick way to remove the line space between the lines? And then I might be done :-).

    Thank you for your continued help! I'm almost there!
    Mike

     

    ewinkiser_0-1617199131227.png

    ewinkiser_1-1617199416903.png

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow