Tidy CSV: Trim, Dedupe and Sort avatar

Tidy CSV: Trim, Dedupe and Sort

Pricing

from $5.00 / 1,000 successful csv clean-ups

Go to Apify Store
Tidy CSV: Trim, Dedupe and Sort

Tidy CSV: Trim, Dedupe and Sort

CSV clean-up: trim cells, snake_case headers, drop empty rows, remove duplicates on all columns or chosen key columns, and optionally sort. Output CSV or JSON with a summary. The cleaning code makes no network calls and does no scraping.

Pricing

from $5.00 / 1,000 successful csv clean-ups

Rating

0.0

(0)

Developer

Brightwater Tools

Brightwater Tools

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a month ago

Last modified

Categories

Features

Limited permissions

Share

Clean a CSV in one run: trim stray spaces, tidy the column names, drop empty rows, remove duplicate rows, and optionally sort. Paste your CSV, choose the options, and get a clean table back as CSV or JSON, with a short summary of what changed.

The cleaning code makes no network calls and reads nothing except the CSV you paste in. It does not fetch URLs or scrape websites.

$0.005 per successful clean-up (UNCONFIRMED against the live Store). Failed runs are not charged.

What you can do with it

  • Tidy a supplier price list or a parts list exported from a spreadsheet before you import it somewhere else.
  • Remove duplicate rows, either when the whole row matches or when only key columns such as part_name,supplier match.
  • Convert a European semicolon CSV (or a tab-separated file) into clean CSV or JSON for an API.
  • Sort a table by one column, with numbers sorted as numbers.
  • Turn messy headers such as Unit Cost (USD) into simple names such as unit_cost_usd.

How to use it

  1. Paste the whole CSV into CSV text. The first row must hold the column names.
  2. Set the options you need. The defaults trim spaces, rename headers, drop empty rows and remove exact duplicate rows.
  3. Click Start. The cleaned table appears in the Output tab and the dataset.

Example: cleaned CSV

Example input:

{
"csv_text": "Part Name,Unit Cost (USD),Qty\n Bolt M6 ,1.25, 10\nBolt M6,1.25,10\n,,\nNut M6,0.40,25\n",
"output_format": "csv"
}

Output (one dataset item):

{
"output_format": "csv",
"rows_in": 4,
"rows_out": 2,
"empty_rows_removed": 1,
"duplicates_removed": 1,
"columns": ["part_name", "unit_cost_usd", "qty"],
"content": "part_name,unit_cost_usd,qty\nBolt M6,1.25,10\nNut M6,0.40,25\n"
}

What happened: the spaces around Bolt M6 and 10 were trimmed, the headers were renamed, the all-blank row was dropped, and the second Bolt M6 row was removed as a duplicate of the first.

Example: JSON

Set output_format to json with the same csv_text. The content field then holds a JSON array with one object per row, keyed by the cleaned column names:

[
{
"part_name": "Bolt M6",
"unit_cost_usd": "1.25",
"qty": "10"
},
{
"part_name": "Nut M6",
"unit_cost_usd": "0.40",
"qty": "25"
}
]

Values stay as text, so 1.25 appears as "1.25".

Summary fields

Every successful run returns these fields. A failed run returns no summary, only an error message.

FieldMeaning
output_formatcsv or json, the format of content
rows_inData rows read, not counting the header
rows_outData rows in the cleaned table
empty_rows_removedRows removed because every cell was blank
duplicates_removedRows removed as duplicates of an earlier row
columnsThe cleaned column names, in order
contentThe cleaned table: CSV text, or a JSON array when output_format is json

Input fields

FieldDefaultWhat to enter
csv_texta short sampleThe whole CSV. Required. The first row is the header.
delimiter,One character that separates fields. Use ; or a tab for European or tab-separated files.
output_formatcsvcsv or json.
trim_cellsonRemove spaces around every cell. Turn off to keep the spaces in cells. Headers are always trimmed.
snake_case_headersonRename headers to lower case with underscores. A blank header becomes column_N, where N is its position.
drop_empty_rowsonRemove rows where every cell is blank. The number removed is in the summary.
dedupeall_columnsoff keeps every row. all_columns removes a row when every cell matches an earlier row. key_columns removes a row when the key columns match an earlier row. The first row of each group is kept.
key_columnsemptyComma-separated column names, for example part_name,supplier. Needed when dedupe is key_columns.
sort_byemptyOne column name to sort by, after duplicates are removed. Leave empty to keep the original order.
sort_orderascasc (smallest first) or desc (largest first). Used only when sort_by is set.
max_input_bytes1,000,000The largest CSV accepted, in bytes. The hard limit is 5,000,000.

Pricing

  • $0.005 per successful run (UNCONFIRMED against the live Store) (event conversion). One run cleans one CSV, whatever its size up to the limit.
  • Failed runs (bad input, a wrong option, a CSV that cannot be read) are not charged.
  • Small files: the price is the same flat amount for any file size. For files of about six rows or fewer, some per-row actors in this category cost the same or less, at the prices their Store pages showed on 2026-10-26. Compare before you choose.

Limits

  • Size limit: the CSV can be up to 1 MB by default (max_input_bytes, up to 5 MB). The limit counts bytes, so accented text takes more than one byte per character.
  • Values stay as text. Numbers are not reformatted: 1.20 stays 1.20, and JSON output holds every value as a string.
  • No formula escaping. Cells that start with =, +, - or @ are written as they are. The actor adds no quote or other escape, so Excel and Google Sheets may treat them as formulas. Check untrusted data before you open the output in a spreadsheet.
  • Sorting uses Unicode code points. Numbers such as 1.25, -3 or 1e3 sort by value. Other text sorts by code point, so capital letters come before lower-case ones (B before a). This is not a locale-aware sort, so accented letters do not sort next to their base letter.
  • Duplicates are exact matches after trimming (when trimming is on), and they are case-sensitive: bolt and Bolt are different.
  • Blank means blank even with trimming off. A cell that holds only spaces counts as blank when empty rows are dropped and when sort_by places blank cells last. With trim_cells off, such a cell is still written with its spaces, and duplicate removal still compares it exactly.
  • Column names must be unique after cleaning. If two headers become the same name, for example Unit Cost and unit_cost, the run stops and asks you to rename one.
  • Ragged rows: a row with fewer values than the header is padded with blanks. A row with more values than the header stops the run, and the message gives its line number.
  • Sorting rules: blank cells always go last, in both directions. In desc order, text comes before numbers, because the whole order is reversed. Only one sort column is allowed.
  • One delimiter character: the delimiter must be a single character that is not a quote or a line break.
  • Values are never reformatted: dates, currency symbols and decimal places are kept as typed. The one change is that spaces around a value are removed when trim_cells is on, which is the default.

FAQ

Does it send my data anywhere? No. The cleaning makes no outside requests. It runs inside your Apify run, and the result is saved to your run's dataset on Apify, as with any Apify actor.

Will it change my numbers or dates? No. Values are kept as text and never reformatted. Trimming cell spaces, renaming headers, dropping empty rows and removing duplicates are on by default, and each can be turned off. Header spaces are always trimmed, whatever trim_cells is set to. Sorting is off until you set sort_by.

Can I call it from code? Yes, through the Apify API or the Apify client for JavaScript or Python, like any Apify actor.

I found a bug or need a feature. Open an issue on this actor's Issues tab.

AI use

This actor was written with the help of AI coding tools. The rules above describe exactly what the cleaning does.


Made by Brightwater Tools.