Merge & Deduplicate Datasets: CSV/Excel Cleaner, Only New Rows avatar

Merge & Deduplicate Datasets: CSV/Excel Cleaner, Only New Rows

Pricing

from $0.01 / 1,000 input rows

Go to Apify Store
Merge & Deduplicate Datasets: CSV/Excel Cleaner, Only New Rows

Merge & Deduplicate Datasets: CSV/Excel Cleaner, Only New Rows

Merge scraper datasets and CSV or Excel files, remove duplicates across all of them, and get only the new rows on scheduled runs. Standardizes emails, phones, dates, names, addresses and countries, and logs each change. $0.01 per 1,000 rows.

Pricing

from $0.01 / 1,000 input rows

Rating

0.0

(0)

Developer

Aidan McCollum

Aidan McCollum

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Features

Limited permissions

Share

Clean a messy CSV, Excel or JSON file, or the output of any Apify Actor. You get typed, deduplicated records and a log of each value it changed. The cleaner reads each column's values to work out what the column holds, fixes formats, and merges duplicate records. When it holds a row back, it tells you which row and why.

What it fixes

Column typeWhat happensExample
EmailTrimmed, lowercased, display names removed, obvious provider typos fixedBob <BOB@gmial.com> → bob@gmail.com
Phone (any country)Checked as a possible number and formatted13743111047 → (374) 311-1047
DateISO YYYY-MM-DD, day-first or month-first decided per column, Excel day numbers read05/03/19 → 2019-05-03, 45352 → 2024-03-01
TimestampISO with the time kept3/2/2024 9:00 AM → 2024-03-02T09:00:00
MoneyA number, with decimal commas read as such1.234,50 € → 1234.5
Numbers and percentsWhole numbers stay whole5.0 → 5, 12.5% → 12.5
IDs, SKUs, order numbersKept exactly as written00123 stays 00123
Barcodes, ISBNs, IBANs, VAT numbersChecked against their check digit; zeros Excel dropped come back only when the check digit confirms them; failures flagged36000291452 → 036000291452
Street addresses (US)Street type, direction and unit written the way most of the column writes them123 north main street apt 4b → 123 N Main St Apt 4B
Postal codes (177 countries)Uppercase with the country's spacing, by column or by each row's countryec1y8sy → EC1Y 8SY
UnitsOne unit per column becomes plain numbers; mixed units are flagged12.0 oz → 12 (unit: oz)
Times and durations24-hour times, hours:minutes:seconds7:10 p.m. → 19:10, 90 min → 1:30:00
ZIP codesLeading zeros put back2134 → 02134
CoordinatesDecimal degrees41°30' N → 41.5
NamesEncoding repaired, Last, First reordered, case fixed; companies left aloneMCDONALD, RONALD → Ronald McDonald
States and provincesUS and Canadian two-letter codes, and the local codes of other countriesCalif. → CA, New South Wales → NSW
CountriesISO two-letter codesUnited Kingdom → GB
URLsLowercase host, https:// addedwww.Acme.com → https://www.acme.com
Null markersn/a, none, - and similar become emptyn/a → empty
HTML from scraped pagesTags dropped, entities decoded, line breaks kept where the page broke lines<p>Hand <b>made</b> &amp; glazed</p> → Hand made & glazed

The cleaner repairs broken accents from wrong encodings (Linda Martínez → Linda Martínez) in every text column, and reads files saved in other encodings (Shift-JIS, GB18030, Windows-1251 and more) without garbling them. It reads the file's bytes to tell its format, so a workbook saved as .csv, an old .xls, a gzipped export or a JSON download with no extension all work. It empties values that can't be valid, like the email not-an-email or the state Narnia, and lists each one in that record's _flags with the original value. It never turns an ID into a number: it finds them from leading zeros, codes like SO-100231, and headers like SKU or Invoice #.

Exports straight from Excel or a CRM

Title lines above the header ("Customer export", "Generated 2025-11-01") are skipped and blank lines don't shift row numbers. Two-line headers become one name per column (Revenue Q1), and a file with no header keeps its first record. Totals rows and footnotes go to the review list instead of your data. A file holding several tables (stacked, titled or side by side) is split, and each table is cleaned; the largest is the main output and clean.xlsx gives each table its own sheet. For Excel files the cleaner reads the cell formats too, so a ZIP formatted 00000 keeps its zeros and =SUM rows are recognised as totals.

Flags, not changes

Some values are readable but deserve a look: a throwaway or shared role email (info@), a phone number that can't exist (a 555 number), a barcode with a wrong check digit. The cleaner keeps them and adds a note to the record's _notes.

How it decides dates

05/03/19 can mean May 3 or March 5. The cleaner counts the values in that column that parse only one way and picks the order they support. It saves the decision and the count in columns, for example: "87 values only valid month-first vs 0 day-first".

Duplicates merge into one record

Rows that describe the same record (same email by default, or the columns you choose) become one record, with gaps filled from each copy. When two copies disagree on a value, the cleaner keeps the first one and adds an entry to the review list with the rows and every value they held, so you can decide. Each clean record lists the original rows it came from in _source_rows.

Records that look like the same person or company under a different email are listed in the review list as possible_duplicate groups, each with a confidence and the evidence (for example "same date of birth, last name nearly the same"). The confidence weighs how unusual each match is in your file: a shared rare surname or birth date counts for much more than a shared "Smith" or a town. What a home or an office shares (the address, the landline, the surname, the company) counts once, so spouses, twins, a father and son with one name, and colleagues at one switchboard don't look like one person. A nickname or a spelling variant (Bill and William, Kristy and Kristi), a move, a slip in a phone number or birth date, and a number filed under Mobile on one record and Home on the other still match. The cleaner never merges these on a guess.

No key columns to pick

Leave Columns that identify a record empty and the cleaner picks them. It uses the email column when there is one. Without one, it uses a place ID (Google Maps placeId), a profile link, the website or domain, or the record's link. A website is paired with the phone when there is one, so two branches of one chain stay apart, and https://www.acme.com/ and acme.com count as the same site. The status message and the dedupe_key record in the key-value store say which columns it used and why.

Records that share an email but look like different people (different names, or a birth date, ID number or Jr./Sr. that disagrees), such as a family inbox or an assistant's address, stay apart. The review list shows them as shared_email, with the reason.

Every row is accounted for

The counts always add up: input rows = blank rows + rows sent to review + clean records + merged duplicates. If they don't, the run fails. Rows missing a required column go to a review list with the reason.

Merge several datasets or files

Pick more than one dataset, or add more file links, and the cleaner merges them into one table before cleaning, so it finds duplicates across them: the same lead from a trade-show scan and from a web form becomes one record with both their details. Columns with the same meaning are matched even when the headers differ (E-mail and Email Address, phone, phoneNumber and phone_number, website and domain, Zip and Postal Code). Columns with no match are kept, and two columns of one input never merge into each other. Each row's source column says where it came from. The inputs record in the key-value store lists each input with its rows, and columns_matched lists each column it renamed.

Wide list columns from contact scrapers

Contact scrapers export lists as one column per item: emails/0, emails/1, phones/0, socials/0/url and so on, sometimes thousands of columns. The cleaner turns each list into one column (emails, phones, socials/url) holding its values separated by ; , and cleans each value on its own. Lists inside a dataset (["a@x.com", "b@x.com"]) become the same kind of column. When two copies of a record merge, their lists are pooled. Turn off Turn list columns into one column to keep the columns as they are.

One dataset for a scheduled feed

Set Also add clean records to this named dataset to a name like daily-leads. Each run still writes its own dataset, and also appends the clean records to the named one, created on the first run. Your next step then reads one dataset. Pick a new name: this Actor can only write to a dataset it created. The copy is not charged again.

Only the new rows, for scheduled scrapers

Turn on Only new rows and give the feed a name. The first run outputs everything; every later run outputs only the rows this account hasn't sent under that name before, with Also output rows that changed for rows whose price or title moved. You pay for every input row the cleaner reads, so a daily schedule costs the same as before and hands your next step only what's new. Patchwell remembers a one-way fingerprint of each record's key and content, never the values, and forgets a feed after 90 days without a run.

Clean next month's file the same way

Each run saves a recipe: the column types, date order and phone settings it used. Paste it into Recipe from an earlier run, and the cleaner applies the same rules to the next file, even when that file's values are ambiguous on their own.

How to use it

  1. Give it a file URL (CSV, XLS, XLSX or JSON), or pick the dataset of another Actor's run to clean scraped data. Add more datasets or links to merge them.
  2. Optionally, choose the columns that identify a record, the required columns, and your phone region.
  3. Click Start. Clean records appear in the Output tab. The key-value store holds clean.csv, the change log, the review list and the recipe.

How much does data cleaning cost?

$0.01 per 1,000 input rows ($0.00001 per row). Files it can't read cost nothing.

RowsCost
352 (the sample file)$0.0035
10,000$0.10
100,000$1.00

Example

Input, using the sample prefilled in the form: 352 rows of customer records with mixed date formats, broken encodings, duplicate customers and currency strings.

{ "url": "https://api.apify.com/v2/key-value-stores/7MDnpHF243bNUL5C3/records/customers_messy.csv" }

It returned 301 clean records from 352 rows. It merged 45 duplicates, removed 6 blank rows and fixed 1,432 values, logging each one. Before cleaning, 30.2% of the filled cells were in a clean, consistent form; after, 99.9%.

A clean record:

{
"Customer Name": "Renée Lee",
"E-mail": "rene.lee101@example.com",
"Phone #": "(374) 311-1047",
"State": "CO",
"Signup Date": "2019-05-03",
"Total Spend": 1418.84,
"_source_rows": [2, 21],
"_flags": []
}

Entries from the change log (changes in the key-value store):

[
{ "row": 2, "column": "Phone #", "before": "13743111047", "after": "(374) 311-1047", "rule": "valid number, national format" },
{ "row": 2, "column": "Signup Date", "before": "05/03/19", "after": "2019-05-03", "rule": "ISO date YYYY-MM-DD (MDY)" },
{ "row": 4, "column": "Customer Name", "before": "O'Brien, Linda", "after": "Linda O'Brien", "rule": "trim, fix encoding, Last, First -> First Last, case" }
]

What each run saves

WhereKeyContents
DatasetOne clean record per row, with _source_rows and _flags
Key-value storeclean.csvThe clean records as a CSV file
clean.xlsxAn Excel workbook with Clean, Review, Changes and Columns sheets. IDs and ZIP codes are text cells, so Excel keeps their zeros
changesEach changed value: row, column, before, after, rule
reviewWhat needs a person, each with a type (invalid, conflict, possible_duplicate, shared_email, totals_row, note_row) and the reason
qualityShare of filled cells in a clean form, before and after, per column and overall
columnsDetected type of each column and the evidence
clustersValues that look like variants of each other (likely typos)
schemaA JSON Schema for the clean records
recipeSettings to repeat this exact clean
statsThe row accounting
only_newWith Only new rows: the feed name, the key used, and how many rows were new, changed or seen before
inputsWith several inputs: each input's name, format and row range
dedupe_keyThe columns that identified a record, and why
columns_matchedWith several inputs: each column renamed to line up with another input

Use it from an AI agent

Add this Actor to Claude, Cursor or any MCP client through Apify's MCP server. The smallest call is one link:

{ "url": "https://example.com/leads.csv" }

or a scraper's dataset, kept to new rows for a daily run:

{ "datasetId": "<dataset id>", "onlyNew": true, "onlyNewState": "daily-leads" }

Read the dataset items for the clean records, review for what needs a person, and changes to check each fix before acting on the data.

When a run fails

The status message gives the reason and a code an agent or automation can act on:

coderetry?meaning
invalid_inputnoThe request or file can't be processed. error says why and param names the first bad field.
unauthorizednoMissing or wrong API key. Send Authorization: Bearer pw_live_...; a free key is one POST to /v1/credits/trial.
insufficient_creditnoNot enough credit for this call. Top up, then send the same request again.
payment_requiredyesA call with no API key to a tool an agent can pay for with x402: the PAYMENT-REQUIRED header has the terms. Pay and send it again, or send a key.
forbiddennoResearch paused on this key for 24 hours after repeated declined questions, or the key is on hold (the message says which).
not_foundnoNo such route, file or job for this key.
method_not_allowednoWrong HTTP method: tool calls are POST.
too_largenoOver a size limit (the message gives it). Send a link instead of inline content, or less data.
idempotency_in_progressyesA request with this Idempotency-Key is still running. Retry after Retry-After seconds; you won't pay twice.
idempotency_mismatchnoThis Idempotency-Key was used with a different body. Use a new key for a new request.
rate_limitedyesA free-key, clip or concurrency limit (the message says which). Retry after Retry-After seconds.
source_unavailableyesThe site hosting your file failed for a moment (it answered 5xx or 429, or the download timed out). Wait Retry-After seconds and retry; nothing was charged.
unavailableyesTemporarily unavailable on our side, for example a research provider outage. Wait Retry-After seconds and retry; nothing was charged.
tool_pausedyesThis tool is briefly unavailable; Retry-After gives the seconds until it resumes; nothing was charged.
internalyesOur fault. Retry with backoff; if it repeats, send us the request_id.
cancellednoYou cancelled the job. Nothing was charged.
expirednoThe job's result was kept 7 days and is gone. Run it again.
refusednoThe research question was declined (the row's category says why); not charged.
no_answernoNo answer could be grounded in sources; not charged.
charge_failedyesApify couldn't record the charge, so the row isn't included or billed.
spend_limitnoOver your spending limit for this run; not billed.

FAQ

What about scraped data with nested fields?

Nested objects become columns with dotted names (address.city, address.zip). A list of plain values becomes one column with the values separated by ; , each one cleaned. A list of objects stays as JSON text, so you lose nothing.

Does it verify that emails or phone numbers exist?

It checks each email's format and looks up whether its domain can receive mail (a DNS lookup of the domain's mail servers, once per domain). An address at a domain that doesn't exist or has no mail server gets a note on its record, and the email column's domain_check counts them. It never contacts a mail server or a mailbox, so a mistyped name at a real company still passes. Phone numbers are checked as possible under their country's numbering rules, which doesn't mean the line is in service.

How large a file can it handle?

Files up to 1 GB (10 million rows), or 200,000 dataset items per run. For larger jobs, write to patchwell.support@gmail.com.

Is my data stored?

Patchwell processes your file in a temporary container and deletes it after the call. With Only new rows, it keeps a one-way fingerprint of each record's key and content (never the values) until 90 days after the feed's last run. If a cleaning job runs long, Patchwell holds its result for up to 7 days so it can be collected, then deletes it. Results stay in your own Apify storage. Details are in the privacy policy.

Other Patchwell tools

Questions or a custom need: patchwell.support@gmail.com