LibreOffice Calc · CSV import · Beginner

Keep Leading Zeros in LibreOffice Calc CSV Imports

Stop LibreOffice Calc from deleting leading zeros in CSV product codes, account identifiers and SKUs by setting import columns to text.

Updated 10 October 2026 · Formula checks: testing standards

If an exported product code says 000184 but LibreOffice Calc shows 184, Calc converted an identifier into a number. For a SKU, account number or case reference, those leading zeros are usually meaningful. The reliable fix is to import the field as Text.

Preserve the value when opening the CSV

  1. Choose File → Open and select the original, unchanged CSV.
  2. In Text Import, choose the correct separator.
  3. Click the column heading in the preview for the SKU or ID field.
  4. Set its Column type to Text. Repeat for any other code columns.
  5. Keep quantities and prices in numeric types, and finish importing.
Raw field As a number Imported as Text
000184 184 000184
00402 402 00402
A007 A007 A007

Use this practice CSV with SKUs. Import the sku column as Text and quantity as a number.

Verify that zeros were really kept

After import, if A2 contains 000184, enter these two formulas into empty cells:

=LEN(A2)
=ISTEXT(A2)

Expected results are 6 and TRUE. If LEN(A2) returns 3, the leading zeros were lost.

Can formatting restore zeros after import?

Formatting 184 with a six-digit number format may display 000184, but the underlying value is still numeric 184. That display technique may be appropriate for fixed-width numeric labels, but it doesn’t restore the original identifier in general. Codes with different lengths should remain text.

If the import already changed the values, reopen the original CSV and select Text before clicking OK. Changing an already converted cell to Text does not magically restore missing characters.

Avoid a second conversion when sharing files

An .ods file preserves cell types better than re-importing plain CSV text. When another application requires CSV, export a copy, reopen it and check a few code cells before sending it.

Related: stop CSV values from becoming dates and convert actual quantities from text.

Common questions

Should I use Text even if my ID contains only digits? Yes when leading zeros or exact characters matter.

Do CSV quotation marks force text? Not universally. Some import settings can still convert quoted fields. Explicitly set the column type to Text.


Official reference: LibreOffice Help. This tutorial focuses on LibreOffice Calc; menu names and behavior can vary by version, operating system and locale.