CSV

Stop Excel From Stripping Leading Zeros and Dumping CSV Into One Column

Import semicolon exports with quoted addresses, preserve long identifiers as text, and distinguish a delimiter mismatch from a damaged record.

A warehouse sends a semicolon-separated stock list. On one laptop Excel puts each record in column A. On another the columns split correctly, but item 000417 becomes 417. Both people opened the same file. The first machine chose the wrong delimiter. The second made a type decision after finding the correct field boundaries. Fix the two decisions in that order and keep the original export unopened for comparison. Once the spreadsheet is saved back to CSV, some of the evidence can be gone.

Set a concrete acceptance row

item_id;description;price;bin
000417;"Bracket; left side";12,50;03-04

Expected cells after import
A2  text     000417
B2  text     Bracket; left side
C2  text     12,50   (convert deliberately if needed)
D2  text     03-04
Four cells from a semicolon export retain a leading zero, a quoted semicolon, a decimal comma and a bin code.
Only the three semicolons outside quotes split this example. The quoted semicolon belongs to the description.

The semicolon inside the description belongs to the part name. The comma in the price is a decimal separator in this export. The hyphenated bin label is an identifier even if a spreadsheet recognizes it as a date. This one row catches three different import errors that a header-only preview cannot reveal. If your export has different fields, select an equivalent row containing a quoted separator, a padded identifier and an ambiguous numeric or date-like value to serve as your check.

Establish field boundaries before opening a workbook

Read the original in a text viewer or the local delimiter tool. Try semicolon as the input separator. A CSV-aware reader recognizes quotes around a complete field and keeps the embedded semicolon inside that field. A simple split on every semicolon would produce five cells for the example. Likewise, replacing semicolons with commas throughout the file would change the product description and collide with the decimal comma. If the destination needs a different delimiter, parse the records and write them back with appropriate quoting.

What you seeLikely stageWhat to change
Most rows occupy one cellDelimiter selectionSelect semicolon and verify the column count
One note stretches over several recordsMissing or misplaced quoteInspect the first affected logical record
000417 becomes 417Numeric inferenceDeclare the identifier column as text before loading
Large IDs end in different digitsNumeric precision lossReload original digit strings as text

Physical lines and data records are different counts in a quoted format. A correctly quoted address can include a newline, and a double quote inside a quoted field is represented by two consecutive quotes. When a preview looks wrong, inspect the field before the first displaced value as well as the displaced value itself. Confirm the expected number of fields for several ordinary records and for at least one multiline record. A data supplier's column specification is better evidence than the row with the most separators.

Preserve identifiers through Excel's import step

Open a blank workbook and import the text file with the delimiter explicitly selected. Where the import interface offers type detection, disable it or set identifier columns to text before loading the data. In a query-based import, inspect the applied steps for an automatic type change. Remove that conversion before setting the type to text if it already turned the original strings into numbers. Converting the number 417 back to text produces three digits, not the six digits you started with.

CSV quotes tell a parser where a field ends. Putting quotes around "000417" does not declare the cell's spreadsheet type. A numeric display format with six zero placeholders can make 417 appear as 000417, but the stored value remains numeric. That difference matters when a lookup compares the text identifier from another system or an export drops the display formatting. To verify the result, compare the imported identifier with a known text value and check its length, including any initial zeros.

Long all-digit tracking numbers need the same treatment even when none begins with zero. Excel's ordinary numeric cells preserve roughly fifteen significant decimal digits. A changed final digit can send a lookup to a different shipment. Widening the column may change scientific notation into digits without restoring precision. Compare an identifier longer than fifteen digits character for character against the original. For identifiers with different lengths, padding everything to a fixed width merely invents a new naming rule.

Package a workbook for someone who double-clicks

Load the original rows into the on-device CSV to XLSX tool. Set encoding and delimiter, review the preview, then download the workbook. Every cell is written as text, so the recipient can open it without repeating your delimiter and type choices. This suits inventory keys, postal codes and other labels. For analysis, make a separate worksheet or selected numeric column and deliberately convert amounts using the source locale. Check a small total against hand arithmetic before summing an entire price list.

Sometimes a system at the other end expressly requires CSV. Use the on-device delimiter converter to produce the agreed separator and inspect its output in a text reader. Specify the encoding, decimal convention, identifier type and quoting rules in the handoff. Check by importing that output the same way the recipient does. Reopening CSV by double-click for a visual review may reapply the very inference you just avoided even if the delivered bytes still contain every leading zero.

Test a downstream lookup before delivering the workbook. Place a known six-character item key from the warehouse system in a separate text cell and look it up in the imported key column. Inspect the matched description and bin. Repeat with another item that differs only in its leading zeros if the supplier uses both forms. This catches accidental conflation even when the worksheet's display format makes the column look uniform.

Limitations of repair after the fact

The local quote-repair tool can close an unmatched quote at the end of a file or pad a short record with trailing empty fields. Neither operation reveals whether a missing field belonged in the middle. If one opening quote swallowed ten subsequent rows, find the intended end of the note in the source system and repair a copy there. An extra delimiter in an unquoted address and a genuine new column are indistinguishable without a schema or an independent record of that address.

When the only surviving file contains 417, several original identifiers could have produced it. Recover the original key from the supplier, a reference table or a backup before joining records. Review a few matched and unmatched keys, particularly at the boundaries of the file. All three linked tools process locally, so you can perform these checks on sensitive inventories without sending the rows to a server. Keep the validated workbook and the original export as separate artifacts for the next reconciliation.

References & further reading

Tools for this guide