CSVians AI / Guides

Remove duplicate rows

Pick the right key, keep the right record, prove nothing valid was lost.

Duplicates are a business decision

Two rows with the same email are not always duplicates, and two rows with different emails can be the same customer. Before removing anything, decide which columns identify “the same thing” — that is your key.

The three decisions to make

  1. Key columns. What identifies a unique record? A customer_id, an email, or a combination like name + order_date?
  2. Which record wins. When duplicates conflict, keep the newest (by updated_at), the most complete (fewest blanks), or the first occurrence. Say which.
  3. What counts as a conflict. If duplicates disagree on a value, should the winner's value be kept, or should the rows be flagged for review instead of merged?

Example prompt

“Consider rows duplicates when customer_id matches. Keep the record with the latest updated_at. If updated_at is missing or tied, keep the row with fewer blank cells. Leave all other columns from the winning row unchanged. Show me how many rows were removed.”

Common traps

  • Case and spaces create fake distinct values. “Ali@x.com” and “ali@x.com ” will not match until you lowercase and trim first.
  • Blank keys. Rows with an empty key column should usually be kept, not collapsed into one row.
  • Over-wide keys. Matching on every column only removes byte-identical rows, which misses real duplicates.

Verify the result

Compare input and output row counts, then spot-check a few removed rows in the Compare view. The audit shows exactly which records were dropped so you can confirm each one was genuinely redundant.