Skip to content
FileMyLove

CSV codes look identical but do not match: check spaces at the edges

Inspect leading and trailing spaces in exported CSV text before matching product codes or importing records, without deleting meaningful spaces.

By FileMyLove Team2 min read

Two product codes look identical in a preview, yet the destination treats them differently. Inspect the actual text, including spaces before and after the code. Whether the recipient trims those characters is part of its import rules, not something to assume from the display.

A space can be part of a field

RFC 4180 describes spaces as field content that should not be ignored. FileMyLove's Excel-to-CSV writer preserves the text supplied by the workbook reader and encloses fields with edge whitespace in double quotes. Quoting protects the field; it does not clean its contents.

For example, a text cell containing a space before SKU-A is exported with that space inside the quoted field. A trailing space is also retained. This guide concerns text exported from Excel, not a promise that every round trip through a spreadsheet preserves every character or data type.

Decide what counts as the same value

Field Suggested rule to confirm
Product code Are edge spaces invalid, meaningful or ignored?
Full name Which spaces separate parts of the name?
Free-text description Should intentional spacing remain?
Empty-looking cell Is it truly empty or does it contain spaces?

Our recommendation is to agree on rules by column. Removing every space from the whole file can damage names and descriptions while leaving the original matching problem unexplained.

Check a small export

  1. Keep the original workbook and work on a copy.
  2. Select a code that fails to match and compare it with the recipient's accepted value.
  3. Inspect the beginning and end of the cell text in an editor that can reveal whitespace.
  4. Correct only unintended characters under the agreed rule.
  5. Export again with Excel to CSV and test the actual downloaded file in the recipient's import preview.

Compare a few successful records as well as failing ones. If the text still differs, investigate the exact characters instead of repeatedly applying a broad cleanup.

Separate content from CSV punctuation

Do not remove the surrounding quotes as a way to remove spaces. See quoted CSV fields for punctuation and long identifiers for numeric interpretation. These are separate checks from whether the recipient accepts an edge space.