Bug 126235 - FILESAVE: empty cells in CSV not quoted
Summary: FILESAVE: empty cells in CSV not quoted
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-05 05:02 UTC by Thomas
Modified: 2019-07-09 18:00 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas 2019-07-05 05:02:53 UTC
When saving as a csv, with all cells selected and formatted as text, and choosing file format options on save to quote all text cells, empty cells are not quoted.

For example, five cells in a row
"","two","","","5"

would be saved
,"two",,,"5"
Comment 1 Xisco Faulí 2019-07-05 10:02:53 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 Timur 2019-07-05 11:05:25 UTC
Sample is simple.

For example, without quotes: a,,c, ,e
With Quotes: "a",,"c"," ","e"
Meaning that if empty, no need for quotes. If space, there's quote. 
MSO does the same: a;;c;;e

I'll close as NotABug.
If you can explain why this would be wrong and in what situation empty quotes are need, please set back Unconfirmed.
Comment 3 Thomas 2019-07-09 06:36:56 UTC
The example in question is an existing application is set up to receive a file in the form

"","two","","","5"

which is generated by a second application. In this instance I am attempting a manual intervention to fix and error in the data contents of the generated csv. But when I open and resave the document, exploring all possible options, it resaves it. 

,"2",,,"5"

rather than 

"","2","","","5"

(the actual file is 1000s of lines long and very complex)

So either this is a functionality bug, where there software is attempting to quote all cell values and failing (nothing is a possible cell value), or a UI problem, where the save options dialogue is saying it's an option to quote all cell values, when in fact it will only quote cell values that are not null.
Comment 4 Heiko Tietze 2019-07-09 06:45:34 UTC
All cells sounds like "" to me. Means OTOH to bloat the file with pointless quotes, which is not much of a problem today.
Comment 5 Eike Rathke 2019-07-09 18:00:35 UTC
Saving empty cells in CSV as unquoted empty fields is correct. Though saving them quoted (with no further content) is equally correct. A software relying on empty fields being quoted is broken. See http://tools.ietf.org/html/rfc4180 and maybe http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm

Btw, the options dialog does not offer to "quote all cell values", but "Quote all text cells". Which empty cells are not.