Bug 91958 - zero characters are missing when open a CSV file
Summary: zero characters are missing when open a CSV file
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.3.7.2 release
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-09 09:43 UTC by Buck CHEN
Modified: 2022-12-28 12:21 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
zero missing sample (80 bytes, text/csv)
2015-06-09 15:52 UTC, Buck CHEN
Details
Screenshot import window. (37.10 KB, image/png)
2015-06-10 21:57 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Buck CHEN 2015-06-09 09:43:35 UTC
Our CSV file has a column with numbers are matched the pattern: /^00\d{6}$/
After open this file, Calc treat this column as a number. 
All zero in the front are removed. 
Even I change the column data type to 'text'. They are not come back.
Comment 1 raal 2015-06-09 15:41:43 UTC
Hello Buck,

Thank you for filing the bug. Please send us a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO', so please do change it back to 'UNCONFIRMED' once you have attached a document.
(Please note that the attachment will be public, remove any sensitive information before attaching it.)
How can I eliminate confidential data from a sample document?
https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F
Thank you
Comment 2 Buck CHEN 2015-06-09 15:52:24 UTC
Created attachment 116425 [details]
zero missing sample

This is a sample. 
Column 2 'Code', heading zeros will be removed and it seems no way to get back.
Comment 3 Buck CHEN 2015-06-09 15:54:13 UTC
Comment on attachment 116425 [details]
zero missing sample

CSV file
Pile is the separator
Comment 4 Alex Thurgood 2015-06-09 16:29:20 UTC
@Buck : not it will solve your porblem, but this ia also the default behaviour in current versions of Excel
Comment 5 Buck CHEN 2015-06-09 16:58:12 UTC
I wanna know if we can have a config about this. 
Default cell data type can be 'text'.
I have to treat a large amount of CSV files. This is agony for me.
Comment 6 Alex Thurgood 2015-06-09 17:02:27 UTC
Confirming that 

Version: 4.4.3.2
Build ID: 88805f81e9fe61362df02b9941de8e38a9b5fd16
Locale : fr_

opens the attached file and, on specifying the pipe character as the separator, then removes the leading zeroes on final import. These zeroes are however visible during the CSV import wizard preview.

OSX 10.10.3
Comment 7 Buck CHEN 2015-06-09 17:11:56 UTC
During operate the wizard. 
There is an option to select the data type for each column.
But I think there is no multi-column select.
If my file is over 100 columns. It will cost very long time to set each column to 'text'.
Comment 8 Buck CHEN 2015-06-09 17:17:46 UTC
I think I found the solution.
In preview wizard, select the first column.
Then scroll to the right end, and press down <Shift> and select the last column.
It will cover all columns.

Even I need to scroll for a while, it's efficient enough.


PS: If we can have a global config will be better.
Comment 9 m_a_riosv 2015-06-10 21:57:43 UTC
Created attachment 116450 [details]
Screenshot import window.

Win7x64
5.0.0.0.beta2

Works for me using the pipe as separator and set up the second column as text, selecting the head column and selecting text in column type.