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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Is there a way to inse...
Power Automate
Unanswered

Is there a way to insert row into text file or merge two text files?

(1) ShareShare
ReportReport
Posted on by 92

I have a flow that reads a SharePoint list into a CSV table and writes the correct columns to a CSV file into a document library in SharePoint. The group that is trying to read this file for import purposes  wants the first row to be "UTF-8" and then the rest of the valid CSV file. As an example, the end result would look something like below:

UTF-8
name,age,country
Bob,33,US
Joe,44,US

 

I tried looking at doing this after the CSV table was created in the flow and before it was saved to a file but I could not see a way to merge anything with output of the CSV table. Then I tried to find a way to merge the saved CSV file with a simple one line text file that has "UTF-8" in it but all I'm seeing is PDF file merge tools you can buy from 3rd parties. 

 

Is there no way to inject or insert a line into the CSV table or a way to merge two text documents and then save the combined results? 

Categories:
I have the same question (0)
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Is there a way to insert row into text file or merge two text files?

    Hi @MattMcQ 

     

    Sounds like you want to get the CSV file and then Update the CSV file.  Something like:

     

    DamoBird365_0-1614930405219.png

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


  • MattMcQ Profile Picture
    92 on at
    Re: Is there a way to insert row into text file or merge two text files?

    Hi @DamoBird365 

    As far as I know that will not work. Update file replaces the contents of the file. Using your example, imagine that there are two "Get file content" tasks and you want to combine the content of those and save it to a third file. What I'm missing is how to combine the two file contents into one. Hopefully that makes my question clearer. 

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Is there a way to insert row into text file or merge two text files?

    Hi @MattMcQ 


    you should be able to append the get file with new content. Either use concat expression or the append to string variable option.

     

    then update the file.

     

    hope that makes sense.

     

    Damien

  • MattMcQ Profile Picture
    92 on at
    Re: Is there a way to insert row into text file or merge two text files?

    Doh, why didn't I think of that? I have no idea what I was thinking or how I missed trying that. Here's a simple formula that seems to do what I was asking. 

     

    concat(outputs('Compose_UTF-8_line'),decodeUriComponent('%0A'),body('Create_CSV_table'))
  • Community Power Platform Member Profile Picture
    on at
    Re: Is there a way to insert row into text file or merge two text files?

    Can we concat 2 file contents of different pdf files. I tried using the Concat expression but it gives me an empty pdf file as an output of Update the file action

  • fabiopuddu77 Profile Picture
    2 on at
    Re: Is there a way to insert row into text file or merge two text files?

    For me the problem is that I can't add new rows in a csv file everytime I got a new input file. The file is overwrited. Is there any way to do this?

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
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard