CSV Cleaning: Deduplication, Trimming, Column Trimming

Open Tool CSV Cleaner

Four toggles for four kinds of dirt

Exported CSV carries four common problems: fully duplicated rows, padded fields, blank rows and unneeded columns. The toggles map directly: deduplicate identical rows, trim field whitespace, delete blank rows, and keep only the first N columns where zero means all. Controls clean, load a sample, download the cleaned CSV and clear. The interface reports before and after counts with a preview table.

Steps

  1. Load or paste the CSV and check the sample for dirty patterns.
  2. Enable trimming, the step that most affects later matching.
  3. Enable blank-row deletion to avoid inflated counts.
  4. Deduplicate when needed, remembering it compares whole rows.
  5. Set the column limit to what you need, or zero for all.
  6. Clean, compare row counts, then download.

Row deduplication versus field deduplication

Fully duplicated rows mean every field matches, which is the safe definition. Deduplicating on one column requires deciding which record to keep, or updated rows vanish. Whitespace is nearly invisible yet breaks comparisons, since padded and unpadded values differ as strings, making trimming the usual first step. Deleting blanks reduces counts, and comparing against the source reveals accidental data loss. Column trimming keeps a left-hand prefix and cannot skip middle columns. Cleaning never changes encoding, which belongs to conversion.

Common mistakes

Deduplicating on a single column and dropping distinct records. Trimming fields where leading spaces carry meaning. Deleting rows that merely have some empty fields. Setting the column limit wrong and clipping essentials. Skipping the row-count comparison. And expecting cleaning to fix malformed quoting and shifted columns.

Where cleaning is not governance

Business-rule merging needs spreadsheets or databases. Structural repair comes first. And cleaned output should be a new file, keeping the original. Automated cleaning alone lacks auditable rules.

⏫︎