Ask Your Question
0

CSV file format

asked 2020-06-17 09:39:43 +0100

LAD gravatar image

updated 2020-06-17 10:12:15 +0100

Opaque gravatar image

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 flag offensive close merge delete

Comments

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

Earnest Al gravatar imageEarnest Al ( 2020-06-17 10:26:22 +0100 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2020-06-17 10:05:43 +0100

Opaque gravatar image

updated 2020-06-17 10:07:10 +0100

Hello,

activate [x] Quote all text cells:

image description

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.

edit flag offensive delete link more
1

answered 2020-06-17 10:12:57 +0100

robleyd gravatar image

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.

image description

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.

edit flag offensive delete link more
0

answered 2020-06-17 17:44:29 +0100

LAD gravatar image

updated 2020-06-17 17:45:35 +0100

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

"FIELD1","FIELD2","FIELD3","Address"

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

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

but

"FIELD1","FIELD2","FIELD3","Address"

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

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

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

edit flag offensive delete link more

Comments

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?)

Mike Kaganski gravatar imageMike Kaganski ( 2020-06-17 17:54:35 +0100 )edit
1

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

Opaque gravatar imageOpaque ( 2020-06-17 18:21:50 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 163 times

Last updated: Jun 17 '20