ProductInfraBlogDownloadDocs
← Blog

Clean a messy CSV without losing rows

A practical CSV cleanup checklist for dates, identifiers, duplicates, missing values, and row-by-row reconciliation.

The Beeuni Team
Beeuni·September 29, 2026·3 min read

A cleaned CSV can look better and still be wrong. Leading zeros disappear, ambiguous dates turn into the wrong month, and duplicate removal can erase legitimate transactions. Keep the source intact and make every transformation traceable to an original row.

Suppose your order report lives in a connected spreadsheet, a shared drive, or a web dashboard. Point Beeuni to the report and specify the date range. With the required connection or browser access, the agent can retrieve the data and save a source copy before cleaning it.

Have the agent inspect the saved copy first. It should report the delimiter, encoding, headers, parsed row count, and malformed records before changing values. A line count alone is insufficient because a quoted CSV field can contain a line break. Keep the report link, retrieval time, and filters with the copy so you can explain which records were included.

Set rules for the columns that matter

ColumnCleanup ruleLeave for review
Order IDRead as text; preserve leading zerosMissing identifiers or conflicting records
DateUse ISO dates when the source format is knownAmbiguous values such as 03/04/2026
AmountParse using the stated decimal conventionMixed separators or unreadable values
CurrencyKeep an explicit currency per rowAmounts without a known currency
StatusApply an approved label mappingLabels whose meaning is unclear

Decide what counts as a duplicate before removing anything. An order ID can appear on several line items. Two equal amounts can describe different purchases. Start by labeling possible duplicates and explaining the match criteria. Delete rows only when you have a rule that distinguishes accidental copies from valid records.

Request three outputs

Retrieve the report from the connection or page I specify, using the agreed date range.
Save an unchanged source copy and record its origin and filters.
Write and run a cleanup script using the agreed column rules.
Add source_row_number before sorting or filtering.
Keep all successfully parsed source rows in cleaned.csv.
Flag uncertain values instead of guessing.
Put malformed records and issues in review.csv, with reasons.
Write checks.txt with row counts, changed fields, and totals by currency.
Do not overwrite the source or update the live report.

Keep blank amounts blank unless you know they mean zero. Record a failed date conversion separately from a date that was missing in the source. Otherwise, you lose the information needed to fix the row later.

Reconcile before importing

  • Rows: every source record must appear in the cleaned output or the malformed-record report. Explain exclusions separately.
  • Identifiers: inspect values with leading zeros and long numeric-looking strings in a plain-text viewer.
  • Totals: compare amounts by currency before and after cleanup. Do not sum different currencies together.
  • Changes: sample records from each transformation, including trimmed spaces, mapped statuses, and converted dates.
  • Destination: import a small sample into the target application and check how it reads dates and text fields.

Some spreadsheet applications remove leading zeros when opening a CSV. If that happens, check the raw file and import the ID column as text. After reviewing the result, you can ask the agent to write it to a new sheet or destination through a connected tool that supports the action. Confirm the destination and check the imported records; keep the original report unchanged.

More articles

Research

Infrastructure for RSI research: running and evaluating self-improving agents

How Beeuni helps researchers run repeated agent-improvement experiments: edit code and instructions, execute tests, investigate failures, and compare versions.

The Beeuni Team·October 19, 2026·7 min read
Developers

Use Beeuni to run and evaluate a model fine-tuning experiment

Have an agent prepare training data, run a fine-tuning job on your connected training computer, inspect failures, and compare model outputs.

The Beeuni Team·October 18, 2026·5 min read

Product

  • Infra ↗
  • Marketplace ↗
  • Download ↗
  • Use Cases ↗

Resources

  • Docs ↗
  • SDK ↗
  • CLI ↗
  • Blog ↗

Legal

  • Terms ↗
  • Privacy ↗

Connect

  • Support ↗
  • Slack ↗
  • X ↗
©2026 Beeuni