When opening a .csv file (FILEOPEN: CSV) the Text Import tool launches (in background... see bug ID 73751 not resolved) every column has a data type, the standard type makes th program guess the type (theorical reminder) when the type is text a database primary key may begin whith zero (i.e. 01234 is a text, 12345 is numeral), but the data type Text is incorectly guessed as Numerical by the Standard methid. Therefore the zeros are truncated (01234 → 1234) and if user saves the file, data is altered. This column should be recognised as a Text data type. Note that this bug is unherited from the original Excell, maybe because primary keys can't begin with a zero in the USA... However they do begin in with a zero around here in Europe at gouvernemental agencies, this is serious. Thank you. Sample dataset (.csv EOF=End of file): pk;city;zipcode;name; 01001;L ABERGEMENT CLEMENCIAT;01400;L'Abergement-Clémenciat; EOF
Created attachment 110795 [details] Screenshot import window. Hi @jacvigier, thanks for reporting. I think to resolve this situations is the option to select the column type.
If your software is broken, and thinks that 161!=00161 there is always a text column type and double quotes in the source data.
Thank you m.a.riosv, unfortunately, it is not optimal if I have 16 columns to force to text, or if I have many documents to open everyday. Also, there is a risk if a civil servant opens the file with the default method (or even with a Visual Basic macro), changes something not related (adds a new column... adds a new line, updates 1 figure...), then saves and exit : the zipcode (postal code) and other codes (primary key) will be altered in the csv file. I just tried (default saving prompted when user exit LibreOffice) and here is the resulting .csv file : pk,city,zipcode,name,population 1001,L ABERGEMENT CLEMENCIAT,1400,L'Abergement-Clémenciat,780 EOF,,,, Thank you Urmas, I tried with all those 3 samples and the standard method is not recognizing code as char(text) but code as number (then truncating zeros on the left) : pk;city;zipcode;name; "01001";L ABERGEMENT CLEMENCIAT;"01400";L'Abergement-Clémenciat; EOF pk;city;zipcode;name; ''01001'';L ABERGEMENT CLEMENCIAT;''01400'';L'Abergement-Clémenciat; EOF pk;city;zipcode;name; '01001;L ABERGEMENT CLEMENCIAT;'01400;L'Abergement-Clémenciat; EOF
Adding self to CC if not already on
No dev assigned and no patches posted, so REOPENED is probably not right status. Moving back to UNCONFIRMED.
Hello, see help, https://help.libreoffice.org/Common/Text_Import Tip: If you want to include the leading zero in the data you import, in telephone numbers for example, apply the "Text" format to the column. or in import dialog check "Other options/Quoted fields as text" when you have this data: pk;city;zipcode;name; "01001";L ABERGEMENT CLEMENCIAT;"01400";L'Abergement-Clémenciat; EOF Closing as notabug.
Created attachment 114284 [details] Screenshot import window, for first option. For 1/3 sample data in comment #3, seems to work fine with the options showed in the attached screenshot.
Migrating Whiteboard tags to Keywords: (needAdvise -> needAdvice) [NinjaEdit]
'needsConfirmationAdvice' is only used for unconfirmed bugs. Removing it from this bug. [NinjaEdit]