Data cleaning · Free guide

Clean a messy CSV file without losing the information that matters.

Duplicates, mixed dates and disappearing leading zeros are not just formatting problems. Here is a careful import-and-validation method you can apply before trusting a spreadsheet.

T Bruce Studio practical guide · CSV and Excel data quality · Reviewed 2026-10-30

The principle: Keep the raw export untouched. Never delete or overwrite rows merely because they look inconvenient. A customer export, inventory list and financial transaction register can require different cleaning rules.

1. Make an immutable working copy

Save the original CSV as it arrived, with a descriptive filename and date. Record the source system, export period and the expected number of rows if known. Work on a separate copy. When reviewing client data, use the minimum necessary information and avoid exposing confidential details in public tools.

2. Import carefully: do not just double-click

In desktop Excel, use Data → From Text/CSV (the wording varies across versions). Inspect the delimiter, encoding and preview. If Excel proposes automatic type conversion, make deliberate choices before loading.

ColumnExampleRecommended check
Product code00123Keep as text if the leading zeros belong to the identifier.
Long reference123456789012345678Keep as text. Excel numeric precision can alter long identifiers.
Transaction date03/04/2026Confirm whether the source means 3 April or 4 March before converting.
Price1,250.00Confirm decimal and thousands separators, currency and whether negatives are allowed.

Microsoft's Excel data-import documentation explains several automatic conversions that can remove zeros or change long identifiers.

3. Check for structural problems

  1. Headings: Confirm every column has a meaningful, unique header. Two columns both called “Amount” are hard to audit.
  2. Row shape: Every data row should map to the expected columns. A comma inside a quoted address should not become a new column.
  3. Blanks: Count missing values by column, then decide whether empty means unknown, zero or not applicable.
  4. Types: Look for amounts stored as text, inconsistent dates and identifiers turned into numbers.
  5. Duplicates: Distinguish a genuinely repeated export row from two legitimate transactions with the same customer and amount.
Duplicate rule: Do not remove duplicate rows by default. First define the business key. For example, a repeated invoice number may indicate an accidental repeat—or a document with multiple valid line items.

4. Use a small test sample before cleaning everything

Choose representative rows: a blank field, a code with leading zeros, a quoted comma, a date at risk of misinterpretation and a deliberate repeated entry. Decide the expected result for each row before applying any transformation.

A safe text cleanup might remove accidental leading or trailing spaces in an ordinary name field. It should not trim meaningful spaces from free-form descriptions or silently convert identifiers.

5. Validate the exported workbook

  • Compare row counts before and after; explain any intentional exclusions.
  • Spot-check the original and cleaned values for critical identifier, date and amount columns.
  • Check that totals agree where valid, but do not assume every amount column should total to a financial control figure.
  • Open the final workbook in Excel or your intended spreadsheet software to confirm the file really works.
  • Retain the source file and a clear change log.

Run a free first-pass data check

Paste a small, non-sensitive table into Spreadsheet First Aid. It flags exact duplicate rows, blanks and inconsistent column patterns locally in your browser. It does not understand the meaning of an invoice or certify that duplicates should be removed.

For an eligible simple CSV or XLSX that needs a bounded repair and validated editable handover, explore Spreadsheet Rescue · R990. Complex Power Query, macros, cross-system integrations and uncertain corrections remain outside the automated fixed scope.