How to Clean Text Before Importing It Into a Spreadsheet
On this page
Preserve the boundaries first
Before trimming text, determine how records and columns are separated. Tabs, commas and line breaks may be structure rather than cosmetic whitespace. Replacing them all with spaces can turn a table into a single unreadable field.
Clean only the intended characters
Remove accidental leading or trailing spaces from fields that permit it. Keep meaningful line breaks inside quoted CSV fields. If the text came from a PDF, inspect hyphenated line endings and merged columns rather than assuming a whitespace cleaner can reconstruct the original table.
Test a small import
Use a sample containing a leading-zero identifier, a quoted comma and a date. Import it with explicit delimiter and column types, then compare the values with the source. Check record counts after the full import. Save a copy of the original so a mistaken cleanup rule can be reversed without recreating the data.
Browse all guides →Protect identifiers
Postal codes and product references can contain meaningful leading zeros. Import them as text when their exact form matters. Date-like strings can also be silently reinterpreted by spreadsheet software.
Clean in stages
Copy the source, normalize intended whitespace, remove duplicates where appropriate and split columns deliberately. Check row counts after structural changes. Record the order of operations so the next file can be processed consistently.
Keep exploring
Browse the free online tools directory or find more practical advice in the MultipleTools blog.