Line breaks inside cells
A cell contains a line break, so one record can spill across several lines of the file.
What it looks like
Before
| customer | address | what is actually there |
|---|---|---|
| Ana Ruiz | 12 Oak St[line break]Apt 4 | line break inside the address |
| Ben Cho | 9 Elm Ave | single line |
After
| customer | address | what is actually there |
|---|---|---|
| Ana Ruiz | 12 Oak St, Apt 4 | line break replaced with a comma and a space |
| Ben Cho | 9 Elm Ave | unchanged |
How it happens
- Someone pressed the key combination that starts a new line within a spreadsheet cell.
- A multi-line form field, such as an address or a comment, was exported as it was typed.
- Text was pasted from an email or a document with its paragraph breaks.
What it breaks
- A tool that reads the file one line at a time splits the record in two, and both halves have the wrong number of columns.
- Row counts disagree between tools, depending on whether each one honors quoted line breaks.
- Every column after the break shifts, so values land under the wrong headers.
How to spot it
- Compare the number of lines in the file with the number of records it should hold.
- Look for rows with too few columns, followed by a row that starts mid-sentence.
- Search text columns for line break characters directly.
How to fix it
- Read the file with a parser that respects quoted fields, so a break inside quotes stays inside its cell.
- Replace line breaks within a cell with a visible separator such as a comma and a space, if the lines belong together.
- If the lines are really separate facts, such as street and unit, split them into columns instead.
- Repair a file that has already been split by rejoining the broken rows, and check the column count afterward.
- Stray whitespace and invisible charactersTwo values look identical on screen but differ by a trailing space, a non-breaking space, or a hidden character.
- Multiple values in one cellA single cell holds a list, or two different facts, joined by a comma, slash, or line break.
- Addresses written many waysThe same place is written with different abbreviations, word order, capitalization, and levels of detail.
TermsCSV, Delimiter, Parsing, Whitespace