Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use OpenOffice Calc for editing CSV files with TAB as delimiter. No matter what I do, Calc is insisting on adding quotation marks (") to the strings. If a cell content is number only, it's fine.

Is there a way to not let Calc do this? I mean, the TAB is enough for any parser, right?

share|improve this question
To save without quotes check this [post][1] [1]: – Mohamed Samy Feb 11 '15 at 14:03

Why do you need double quotes?

I mean, the TAB is enough for any parser, right?

No, it technically isn't! As mentioned in my answer about Excel's CSV format, the Common Format and MIME Type for CSV Files (RFC 4180) specifies that:

… each field may or may not be enclosed in double quotes (however some programs, such as Microsoft Excel, do not use double quotes at all). If fields are not enclosed with double quotes, then double quotes may not appear inside the fields.

So far, so good. Calc obviously chooses to always enclose it in double quotes.

Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes

… so this is where a double quote has to be in order for the CSV to be parsed correctly again.

Why does Calc add them?

Calc is probably doing that as a safety measure for all text fields. On the contrary, what Excel is doing is somewhat ambiguous.

How can you avoid them?

I found a forum post that suggests using a macro to disable text delimiters:

Dim oDocCsv As Object       
Dim CsvProperties(2) As New 


CsvProperties(0).Name    = "FilterName" 
CsvProperties(0).Value   = "Text - txt - csv (StarCalc)" 
CsvProperties(1).Name    = "FilterOptions" 
CsvProperties(1).Value   = "124,0,ANSI,2" 


oDocCsv.storeAsURL("test.csv", CsvProperties()) 

The important option here is the line with 124,0,ANSI,2. According to the Filter Options reference, the second part (i.e. the 0) disables text delimiters upon export.

share|improve this answer
I don't have OpenOffice to try this, nor have I ever used it, but let me know if that works for you. It might be that the macro has to be used a bit differently, but the important part is the filter option value. – slhck Sep 15 '11 at 10:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .