CSV Doctor | Repair Broken CSV Files, With a Fix Report avatar

CSV Doctor | Repair Broken CSV Files, With a Fix Report

Pricing

from $1.00 / 1,000 row repaireds

Go to Apify Store
CSV Doctor | Repair Broken CSV Files, With a Fix Report

CSV Doctor | Repair Broken CSV Files, With a Fix Report

Repair the CSV that will not load: wrong delimiters, unquoted values, ragged rows, blank and duplicate headers, mojibake. Get back rectangular typed records plus a report of exactly what changed. Nothing is invented and nothing is dropped, so ragged rows are named, never truncated.

Pricing

from $1.00 / 1,000 row repaireds

Rating

0.0

(0)

Developer

Brandon Mensing

Brandon Mensing

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Share

CSV Doctor

broomwagon.

Repair the CSV files that break every parser, and get a report of exactly what changed and why.

Every data pipeline has the file that will not load. The delimiter is a semicolon except on the rows someone pasted in. A revenue column lost its quotes and split 7,500,000 across three fields. One row is short, one is long, the header has a blank in it, and something in the encoding turned every apostrophe into ’. This actor takes that file and hands back rectangular, typed records, plus a fix report you can read before you trust it.

Part of the Broomwagon family: deterministic tools that watch scraped and AI data change. Same file in, same rows out, every time. Nothing is guessed by a model.

What it repairs

ProblemWhat the actor does
Wrong or unknown delimiterPicks the one that makes the file rectangular, not the most common character
Values containing the delimiterHonours quotes, doubled quotes, and newlines inside fields
A row pasted in with another delimiterRe-splits that row, but only when it lands on the right width
An unquoted 7,500,000 split across fieldsRejoins it, but only when that makes the row the right width
Short rowsPads with nulls, so values never shift into the wrong columns
Long rowsKeeps the surplus in _overflow instead of discarding it
Blank headers, repeated headersNames them column_2, suffixes repeats _2
Blank rows, all-blank columnsRemoves them
’, é and friendsRepairs UTF-8 that was read as Latin-1, and strips byte-order marks
Everything is a stringConverts numbers, currency, booleans, and the usual spellings of null

Two rules run through all of it. Nothing is invented and nothing is dropped: a row that cannot be made rectangular is padded or overflowed, never truncated. And every repair is counted, by class, in the FIXES record, with the row numbers that stayed ragged.

Identifiers with leading zeros stay text. A zip code is not the number 742.

Try it in two minutes

Leave the sample in Paste CSV text and run. It is a deliberately broken file: five rows, four different problems. Read the FIXES record to see which rule caught which, then look at the dataset to see Globex rescued from its semicolons and 7,500,000 put back together.

For real work, point fileUrl at the file instead.

Input

  • fileUrl | rawText | datasetId | items: the data. A file URL is the usual path; a dataset of already-parsed records skips parsing but still gets header and type normalization, which is most of the value when a scraper emitted everything as strings.
  • delimiter: force one instead of detecting it.
  • headerStyle: tidy the existing names, or snake_case them for a database.
  • coerceTypes: on by default; turn it off to keep every value a string.

Output

  • Dataset: the repaired records.
  • FIXES: a count per fix class and the rows that stayed ragged. Read this first.
  • OUTPUT: run report, including the detected delimiter and the columns found.

Pricing (pay-per-event)

EventWhat you pay forPrice
record-processedPer repaired row written$0.001
apify-actor-startRun start, per GB of run memory$0.005

Worked example: a 20,000-row export: 20,000 × $0.001 = $20 (plus a penny to start at the default 2 GB), once, versus an afternoon of somebody hand-editing the file and guessing at the ragged rows. A nightly 2,000-row feed: $2 a night, and the fix report tells you the day the upstream format changed.

Set a max charge on any run (Maximum cost per run in Console, or ACTOR_MAX_TOTAL_CHARGE_USD via API) and the actor stops cleanly at your budget.

Integrations

  • API: POST https://api.apify.com/v2/acts/broomwagon~csv-doctor/runs with {"fileUrl": "https://example.com/export.csv"}, then read the dataset.
  • Apify Schedule: put it between a nightly export and whatever loads it, and check FIXES when the loader complains.
  • n8n / Make: HTTP node fetches the file → this actor → your warehouse. The branch that used to fail on malformed rows now gets rectangular records.
  • MCP / AI agents: callable as a tool via the Apify MCP server. An agent handed a broken CSV can repair it deterministically instead of hallucinating the missing columns, which is the failure mode when an LLM is asked to "fix this file".

Roadmap

Date parsing with an explicit format hint, per-column type locking (so one bad row cannot flip a column to text), and an option to emit the repaired file as CSV rather than as records.

The Broomwagon family

This actor is one of nine deterministic post-processing tools from Broomwagon: the layer that follows your scrapers and agents, cleaning and watching what they produce. Same input, same output, every time.