# CSV file format

I need to CSV file format like this

"FIELD1","FIELD2"

"John JR","Smith"

"Sandra P","Bush"

That is: fileds are delimeted with a comma and each field is separated with " . How can I achieve that in LIbre Office? I tried to choose " as a string delimeter but it does not work. Thanks

[Edit - Opaque] Retagged, since it isn't a "common" question but related to calc

edit retag close merge delete

This seems to be a Calc question, not common, please re tag

I tried with your example, except I added a comma after each first name and before the initials. Using Calc I saved it as csv with the default settings. On inspection in Notepad it shows the following:

FIELD1,FIELD2
"John, JR",Smith
"Sandra, P",Bush


If I open the same csv file in Calc it doesn't show the string delimiter because it is not part of the contents of the field, however it does use them to ignore the comma between the first name and initials. It doesn't need the string delimiter where a text comma within the field doesn't exist.

For more on CSV see https://www.ietf.org/rfc/rfc4180.txt

Cheers, Al

( 2020-06-17 10:26:22 +0200 )edit

Sort by » oldest newest most voted

Thanks for replies. But still not good for me If any of a collumn is blank I will not get

"John","","Smith","RiverDale"

"Sandra ","P.","Bush",''''

but

"John",,"Smith","RiverDale"

"Sandra ","P.","Bush",

that is empty field is not string delimited, only field delimited. Is there a solution? Thanks

more

Empty cell is not a text cell. Thus it isn't considered by the "Quote all text cells" option.

(Are you posting this in the "Propose Your Solution" in purpose, thinking that your message solves your question?)

( 2020-06-17 17:54:35 +0200 )edit
1

I like it - make me a solution for requirements I'll partly tell you afterwards.

( 2020-06-17 18:21:50 +0200 )edit

Create your list in Calc; then use Save As and choose Text CSV from the options. When asked for the Field Options, select as below - you may need to vary the character set depending on your needs. Note that Quote all text cells is selected. The field delimiter is a comma, in case it isn't clear from the image.

Using the data in my sample spreadsheet shown, the result is

"Title","Title2"
"Fred","Bloggs"
"Bill","Doe"
"John","Jones"
"Agatha","Smith"


If this answer helped you, please accept it by clicking the check mark to the left and, karma permitting, upvote it. That will help other people with the same question.

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

more

Hello,

activate [x] Quote all text cells:

Tested using LibreOffice:

Version: 6.4.4.2, Build ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kf5;
Locale: en-US (en_US.UTF-8); UI-Language: en-US, Calc: threaded


Hope that helps.

more

## Stats

Asked: 2020-06-17 09:39:43 +0200

Seen: 205 times

Last updated: Jun 17 '20