Dataset Stream Transform — Merge, Deduplicate, Filter Big CSV avatar

Dataset Stream Transform — Merge, Deduplicate, Filter Big CSV

Pricing

from $0.24 / 1,000 rows

Go to Apify Store
Dataset Stream Transform — Merge, Deduplicate, Filter Big CSV

Dataset Stream Transform — Merge, Deduplicate, Filter Big CSV

Merge, filter, dedupe, rename and export CSV, TSV, JSON, JSONL and XLSX files or Apify datasets. It streams: a million-row input runs in 1-2 GB without crashing, and you pay only for the rows you keep.

Pricing

from $0.24 / 1,000 rows

Rating

0.0

(0)

Developer

Northbell

Northbell

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Features

Limited permissions

Share

Dataset Stream Transform — Merge, Deduplicate, Filter and Export Big CSV, JSON, XLSX Files and Datasets

Filter, dedupe, rename and export tabular data from files or Apify datasets. It streams: a million-row CSV or dataset runs in 1–2 GB without crashing, and you pay only for the rows you keep. $0.30 per 1,000 kept rows. Rows dropped by a filter, as duplicates, or as already seen are free.

Try it now — the input is already filled in. Press Start: it streams the public-domain OurAirports list (86,343 rows, 8.8 MB CSV), keeps the large airports in Japan and drops a second airport in the same city — 29 rows match, 28 are kept (about $0.01). Then put your own CSV, TSV, JSON, JSONL or XLSX URL (or an Apify dataset ID) in Sources.

It can also run automatically after your scraper: see "Run it after your scraper" below.

Two of the 28 rows from our own run of exactly this input on Apify (21 Nov 2026, 4 seconds):

{ "ident": "RJAA", "type": "large_airport", "name": "Narita International Airport", "elevation_ft": "141", "continent": "AS", "iso_country": "JP", "iso_region": "JP-12", "municipality": "Narita", "icao_code": "RJAA", "iata_code": "NRT", "gps_code": "RJAA", "local_code": "", "coordinates": "35.76858, 140.388714" }
{ "ident": "RJAH", "type": "large_airport", "name": "Ibaraki Airport", "elevation_ft": "105", "continent": "AS", "iso_country": "JP", "iso_region": "JP-08", "municipality": "Omitama", "icao_code": "RJAH", "iata_code": "IBR", "gps_code": "RJAH", "local_code": "", "coordinates": "36.181456, 140.414434" }

And its OUTPUT summary in the key-value store:

{
"read": 86343,
"kept": 28,
"droppedByFilter": 86314,
"droppedDuplicates": 1,
"droppedSeen": 0,
"sources": [{ "source": "https://raw.githubusercontent.com/datasets/airport-codes/main/data/airport-codes.csv", "read": 86343, "kept": 28, "error": null }],
"seconds": 0.7,
"peakRssMb": 123,
"stoppedBy": null,
"exportCsvUrl": null
}

For your own file: { "sources": ["<your CSV link>"], "filters": [{ "field": "country", "op": "eq", "value": "JP" }], "dedupeBy": ["email"], "exportCsv": true }.

Measured: 1,000,000 rows (143 MB CSV, about 10% repeated keys, some in full-width), filter country = JP (20% of rows), dedupeBy email, CSV export on: kept 179,002, dropped 800,000 by the filter and 20,998 as duplicates. Peak memory 282 MB. Run time 537 seconds on a Windows PC, almost all of it spent by the local test storage writing 179,002 separate files; a second run on the same file that kept nothing (so it only read, filtered and checked 1,000,000 rows) took 7.2 seconds at 248 MB. On Apify, the 86,343-row sample above was read and filtered in 0.7 seconds at a 123 MB peak.

Why it does not crash on big input

Most converters load the whole file, then work on it. This one reads a file line by line (an Apify dataset page by page, 1,000 items at a time), pushes kept rows in batches of 500, and never keeps the rows. The only thing it holds in memory for the whole run is a short hash of each dedupe key, about 40 bytes per kept row when you dedupe, and nothing when you do not. Ten million distinct keys need roughly 400 MB.

Input

FieldWhat it does
sourcesRequired. Apify dataset IDs, or URLs of CSV, TSV, JSON (one array), JSONL/NDJSON or XLSX files. Read one after another. Dedupe works across all of them.
formatauto (default): from the file extension, then the content type, then the first character. Set it when the URL has no useful extension.
filtersList of {field, op, value}. See the table below. Empty: keep every row.
filterModeall (default): a row must pass every filter. any: at least one.
dedupeByField names. Rows with the same values are duplicates; the first is kept. Empty: no dedupe.
normalizeForDedupeDefault on. See "Dedupe".
selectFields to keep, in this order. Empty: all fields.
renameOld name to new name. Applied after select.
flattenDefault off. On: {"a": {"b": 1}} becomes {"a.b": 1}.
onlyNewSinceLastRunDefault off. Needs dedupeBy. Drops rows whose key an earlier run already returned to you; they are not charged.
exportCsvDefault off. Also writes the kept rows to EXPORT.csv in the key-value store; the link is in OUTPUT.
maxRowsStop after this many kept rows. 0: no limit.

Order of work for each row: filter, dedupe, already-seen check, row limit and charge budget, then flatten, select and rename. A row dropped by a filter is never remembered as a key.

Filter ops

OpKeeps the row when
eq, neThe value equals (or differs from) value. Text is compared after Unicode NFKC, trimmed, case-insensitive.
contains, notContainsThe text contains value (same normalization).
regexThe text matches. value is a pattern, or /pattern/flags such as /^tokyo/i.
gt, gte, lt, lteNumeric comparison when value is a number (commas ignored); otherwise text comparison. A row that is empty or not a number is dropped.
in, notInThe value is one of the listed values. value is a list or a comma-separated string.
isEmpty, notEmptyThe field is missing, null, blank or an empty list (or not).
before, afterThe field is a date earlier (or later) than value, such as 2026-11-20. A row whose field is not a date is dropped.

Field names can be nested: address.city. A bad filter (unknown op, broken regex, before with a non-date) stops the run at the start, before anything is charged.

Dedupe

With normalizeForDedupe on, each key value is made comparable before it is hashed: Unicode NFKC (full-width and half-width forms match, so ABC equals abc, and half-width katakana equals full-width), trimmed, lower case, repeated spaces collapsed. A value that starts with http://, https:// or www. also loses its query string, fragment and trailing slash, so https://x.com/a/?utm=1 equals https://x.com/a. Hiragana and katakana are not treated as the same.

A row whose key fields are all empty has no identity: it is kept and never counted as a duplicate. The key is stored as a 52-bit hash; for ten million distinct keys the chance of one false duplicate in a run is about 1 in 100.

Only new since last run

For a schedule that reads the same source every day. The Actor keeps a named key-value store (dataset-stream-transform-seen) with the hashes of the dedupe keys it returned, newest 5,000,000 at most. If that store cannot be opened the run stops before charging. Rows that were cut off by a charge limit or a time limit are not saved as seen, so the next run returns them.

Run it after your scraper

In Apify Console, open your scraper's Integrations, add Run Actor, pick this Actor and give it an input such as:

{
"sources": ["{{resource.defaultDatasetId}}"],
"filters": [{ "field": "email", "op": "notEmpty" }],
"dedupeBy": ["email"],
"onlyNewSinceLastRun": true,
"exportCsv": true
}

Each scraper run then hands its dataset over: you get only the rows that pass your filters and that you have not had before, and you pay only for those. A daily schedule works the same way with a fixed dataset ID or file URL.

Output and price

  • Kept rows go to the default dataset. OUTPUT in the key-value store holds the summary: read, kept, droppedByFilter, droppedDuplicates, droppedSeen, per-source read, kept and error, seconds, peakRssMb.
  • Charge: event row-kept per row pushed, $0.0003 ($0.30 per 1,000). The batch is pushed first, then charged. The Actor respects your maximum total charge for the run and stops cleanly when it is reached.

Limits

  • XLSX: first sheet only; row 1 is the header. The file is saved to the run's disk first, then the sheet is read row by row.
  • JSON must be one array of objects. For anything else use JSONL.
  • CSV and TSV: UTF-8, header row required, values stay text. In the CSV export, the columns are those of the first 500 kept rows (or your select); a key that appears only later is left out of the CSV (the dataset has it). Nested values are written as JSON text.
  • A source that cannot be read (bad URL, 404) is reported with an error in the summary and the run goes on with the next source. The run fails only if no source could be read at all.
  • The Actor stops 30 seconds before the run's time limit; everything charged is already in the dataset.
  • Files are fetched over HTTP(S) from public URLs. Compressed files (.gz, .zip) are not unpacked.

日本語の説明

CSV・TSV・JSON・JSONL・XLSX のファイル、または Apify のデータセットを、ストリームで(全部をメモリに載せずに)絞り込み・重複除去・列の整理・CSV 出力する Actor です。100万行規模でも 1〜2 GB で動きます。課金は残した行だけ(1,000行あたり 0.30 ドル)で、絞り込みや重複で落とした行は無料です。重複判定では全角・半角を同じものとして扱い(ABC と abc、半角カナと全角カナ)、URL は末尾のスラッシュとクエリを無視します。「前回以降の新規のみ」を使うと、毎日同じ元データを読む定期実行で、すでに返した行を除けます。