cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Change the delimiter when creating a CSV file

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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Admin_A
New Member

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 !

View solution in original post

nihkel
Frequent Visitor

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 🙂

View solution in original post

7 REPLIES 7
v-yamao-msft
Community Support
Community Support

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 Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

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
Frequent Visitor

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

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

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/...

 

Hope this helps @SwapnaNethi 

Admin_A
New Member

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 !

View solution in original post

nihkel
Frequent Visitor

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 🙂

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (76,548)