On 12/21/2012 04:52 PM, Rich Shepard wrote:
I've been going around in circles on this issue for most of today
without
finding the solution. The context:
I have several large data files provided in .csv format that need to
be edited and have column formats made explicit.
These files are recognized by LO/Calc as spreadsheets when I open
them and I change the field separator from a tab to a comma. They display
correctly in the spreadsheet.
I explicitly format text, integer, and floating point columns by
highlighting the column(s) and selecting Format -> Cells and selecting
the
appropriate choice.
The problem comes when I save the explicitly-formatted file: the text
fields are quoted only when they have content, not when they are blank.
This, of course, prevents correctly reading the files into database
tables
or R data frames. I have tried all sorts of kludges to force Calc to
display
the .csv dialog box where I can tell it to quote all text fields, but
those
cells without content are saved as ,, rather than ,'',.
What do I do so that blank cells in text-formatted columns are
quoted in
the saved (or saved-as) .csv file?
TIA,
Rich
Rich,
In a csv file the field delimiter is usually a comma and to denote what
is a string that may contain a comma quotation marks are used. If the
cell in the original format was empty or NULL in a database nothing is
exported. For example the export from a database might look like this:
1,"text string, test",,,"the last two were NULLs in the database",34
2."another string",3,3,,57
For the exported value to an empty string ("") the original value must
be an empty string "" not an empty cell. When importing into a database
is it often better to have the equivalent to a NULL value because the
each column in the database will have an assigned data type and the
empty string will cause an import error if there is data type mismatch.
The empty string will cause problems with numeric data.
--
Jay Lozier
[email protected]
--
For unsubscribe instructions e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted