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 / Change the delimiter w...
Power Automate
Answered

Change the delimiter when creating a CSV file

(0) ShareShare
ReportReport
Posted on by

I am querying a SharePoint List and using the Create CSV Table action to generate a CSV file.

However I want the file to be pipe("|") separated.

 

Is there a way to change the delimiter when creating a CSV file. I would greatly appreciate any advise on this.

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi @Anonymous,

     

    By default, a comma is used to separate the items. If you want the file to be pipe separated, you could use a replace function to replace the comma with a pipe.

     

    Under the Create CSV table, add a Compose action, and use the following code:

    replace(body('Create_CSV_table'),',','|')

     

    Then in the email body, select the output from the Compose action.

    1.PNG

     

    Please have a try with it on your side.

     

     

    Best regards,

    Mabel Mao

  • Community Power Platform Member Profile Picture
    on at

    HI Mabel,

     

    Thank you for the reply but the solution proposed by you will also replace any comma in the input file with a pipe ('|').

    I just want the separator to be changed from comma to pipe while keeping the "commas" elsewhere intact.

  • nihkel Profile Picture
    65 on at

    Any updates on this topic?

    This is 2 years old and a pretty basic feature.

     

    Has anyone come up with a working solution that doesn't reaplace all particular characters in the CSV but only the delimiter/separator?

     

    Thanks in advance for your help,

    Best regards

  • Community Power Platform Member Profile Picture
    on at

    I am also looking for a solution for this. Any update?

  • nihkel Profile Picture
    65 on at

    I was kindly pointed to some potential workaround in a similar thread:

    https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Changing-the-delimiter-in-Create-CSV/idc-p/631006#M22002

     

    Hope this helps @Anonymous 

  • Verified answer
    Admin_A Profile Picture
    11 on at

    If you intend to do this with the data contained in a SharePoint List, you could :
    1) Get your elements with the SP connector;

    2) Initialize a string variable with the columns names you would like, e.g. "name;surname;email" and by hitting enter to add a carriage return;

    3) Use "Apply to each" on the value element returned by the SP Get elements block;

    4) In the apply to each loop, use an "Add to string variable", where the content would be the dynamic fields extracted from SP, separated with ";" and with a carriage return at the end of the line (hit enter)

     

    Then you can add your string variable as the content of an attachment for instance.

    Hope this helps !

  • Verified answer
    nihkel Profile Picture
    65 on at

    Hi @Admin_A 

    thank for your reply.

     

    I had taken a similar route in order to reach the same destination.

    I'm creating the CSV table as intended by MS Flow, but I'm using 'custom columns'.

    On each header/column I'm adding some special characters (note that these are also forbidden in the SP list, via column validation).

    nihkel_0-1598950790454.png

    Note the pipes encapsulating the content (everywhere except the line jump, since I'm using the default carriage returns on the CSV).

    My aim was to create an easily replaceable set of characters (in my case, pipe-comma-pipe) I could look for, and then replace it as a whole for the character I need to be used as separator.

     

    So next step is a compose action with a replace expression for the 'character set' I created.
    I look for |,| and then replace it with my desired separator.
    I also didn't needed to take the carriage retun into account since I'm using the default ones created for each line on the CSV.

     

    I hope thi can help someone 🙂

  • 55552 Profile Picture
    674 on at

    Thanks, this was very helpful. We did almost the same thing, although for some reason, a single replace statement looking for |,| did not clean all the records. Where we had comment fields with commas internally, we needed two more replace statements.  We also switched to the ^ symbol, since some of our comment fields also contained pipes! So our three replace/compose statements after the create csv table action were: 

    replace(body('Create_CSV_table'), '^,^''^')   This replaced ^,^ with a single ^
    replace(outputs('Compose'), ',"^''')  This searched for "^, and replaced it with nothing
    replace(outputs('Compose_2'), '"''')  This searched for a double quote mark, and replaced it with nothing.
  • takolota1 Profile Picture
    4,974 Moderator on at

    Hello All,

    I ran into similar issues when pulling CSV data in from Power Automate Desktop with commas in the actual data. I wanted to change the delimiter so I could more easily parse the data without commas in the actual data messing things up.

    Here's a link to the scope/flow I built so anyone can easily select their CSV data, enter a new delimiter, and get the new delimiter separated data from the final compose action without the usual errors. The file data just needs to have double quotes around any of the records with commas in them or be converted to a text file that automatically applies quotes to those records.
    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Change-CSV-File-Data-delimiter/m-p/1442954#M531

  • arielbelaus Profile Picture
    20 on at

    Hello all!

    I'm exporting a CSV from a paginated Report and I need to replace the comma delimiter to ~. I tried with a compose formula replacing the , with the ~ but I have some data with , and I don't want to replace those.

    Any ideas or solutions about it?

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard