Dataset Aggregate, Group By & Pivot avatar

Dataset Aggregate, Group By & Pivot

Pricing

from $1.00 / 1,000 input row processeds

Go to Apify Store
Dataset Aggregate, Group By & Pivot

Dataset Aggregate, Group By & Pivot

Returns GROUP BY and pivot tables for any Apify dataset, file or Google Sheet by URL, or JSON array: count, sum, average, min, max, median per group, date buckets, pivot columns. Exports CSV/Excel, appends to a named dataset, posts to a webhook. Agent-ready: pay per event (x402, MCP), per input row.

Pricing

from $1.00 / 1,000 input row processeds

Rating

0.0

(0)

Developer

Adam Pearce

Adam Pearce

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Share

Just scraped 5,000 rows and now you need the summary, not the rows? Orders per region, average price per brand, listings per city per month, top 10 products by revenue? This Actor is SQL GROUP BY and a spreadsheet pivot table for any Apify dataset, any CSV, Excel or JSON file or Google Sheet by URL, or a JSON array you paste in. Point it at your data, say what to group by and what to compute, and get back a clean summary table plus a ready-to-open CSV or Excel file, appended to a named dataset that accumulates across runs, or POSTed to your webhook.

No scraping, no API keys, no browser. It only processes data you already have, so there is nothing to break and nothing to maintain.

What it does

  • Group by one or several fields (like SQL GROUP BY), including nested fields via dot paths (address.city). Leave the group fields empty to summarize the whole dataset into a single row.
  • 11 aggregation functions: count, countDistinct, sum, avg, min, max, median, first, last, list, listDistinct. As many per run as you want, each with its own output column name.
  • Date bucketing: group a date or timestamp field by day, ISO week, month, quarter or year (orderedAt becomes orderedAt_month = 2026-08). Accepts ISO dates, common date strings, and Unix timestamps in seconds or milliseconds.
  • Pivot tables: turn one field's distinct values into columns. Group by region, pivot on product, fill the cells with sum of amount, and you get one row per region with a column per product, zero-filled where a combination has no rows.
  • Lenient numbers (on by default): sums and averages read "$1,234.50", "49 USD", "12%" and "(300)" as numbers, which is what scraped prices usually look like. Values that genuinely are not numbers ("n/a") are skipped and honestly counted in the run summary, never guessed.
  • Normalized grouping (on by default): South, south and SOUTH land in the same group, with one consistent label in the output. Switch to exact matching when byte-for-byte distinction matters.
  • Sort, top N, totals: sort by any output column, keep only the top N groups (top 10 products by revenue), and add a grand-total row covering every input row.
  • Files and Google Sheets in: paste a CSV, TSV, Excel, JSON or JSON Lines link, or a Google Sheet link, into File URL and it is summarised the same way as a dataset. The download is never charged.
  • Real file export: a ready-to-open CSV and/or Excel (.xlsx) file with a bold, frozen header row, saved to the run's key-value store.
  • A named dataset that accumulates: set Also append to a named dataset and every scheduled run's summary lands in one dataset instead of one per run. Not charged.
  • Webhook delivery: set Webhook URL and the summary rows are POSTed to Slack, Zapier, Make, n8n or your own endpoint the moment the run finishes (see below).
  • A summary report (AGGREGATE_SUMMARY): rows in, groups out, skipped values per column, and explicit warnings for things like a misspelled field name, so a typo never silently produces an empty result.

Example

Input rows (from any scraper, or pasted inline):

[
{ "region": "North", "product": "Widget", "amount": "$1,200.00", "orderedAt": "2026-07-03" },
{ "region": "North", "product": "Gadget", "amount": 350, "orderedAt": "2026-07-18" },
{ "region": "south", "product": "Gizmo", "amount": 120, "orderedAt": "2026-08-02" }
]

Group by region, count orders, sum and average amount:

regionorderstotal_amountavg_amount
North21550775
South1120120

Or group by region, pivot on product with sum of amount:

regionordersGadgetGizmoWidget
North235001200
South101200

How to use it

  1. Point Dataset to aggregate at any existing dataset on your account (any scraper run's output), paste a link into File URL (CSV, TSV, Excel, JSON, JSON Lines, or a Google Sheet), or paste rows into Data (inline).
  2. Set Group by field(s), e.g. region, or city + category.
  3. Set Aggregations, e.g. [{"field": "price", "function": "avg", "alias": "avg_price"}]. Leave empty for a plain row count per group.
  4. Optionally set a date bucket, a pivot field, sort, top N, a totals row, and export formats.
  5. Pick where the result goes: this run's dataset (always), a named dataset that accumulates across runs, a CSV or Excel file, or a webhook. Run.

Works the same from the API and from AI agents via MCP: the input is plain JSON, the output is a plain dataset.

Bringing in a file or a Google Sheet

Set File URL to any public link. The format is detected from the extension, the content type and the content itself, or force it with File format:

  • CSV / TSV: header row required; quotes, embedded newlines and semicolon or tab delimiters are handled.
  • Excel (.xlsx): the first sheet, header row in row 1; dates come out as ISO strings, formulas as their computed values.
  • JSON: an array, an object wrapping an array ({"items": [...]}, {"data": [...]}), or one object per line (JSON Lines).
  • Google Sheets: paste the normal sheet link. Set sharing to "Anyone with the link can view" (or File > Share > Publish to the web); the Actor converts it to the CSV export link for you, including the specific tab if the link carries a gid.

Up to 100 MB per run. Values read from a CSV or sheet are text, which is exactly what Lenient numbers (on by default) is for: "1,234.50" sums correctly.

Webhook destination

Set Webhook URL in the input and the aggregated rows (plus download links and the run summary) are POSTed there as JSON the instant the run finishes, so a scheduled weekly GROUP BY lands in Slack, Zapier, Make, n8n or your own API on its own, no need to poll the dataset or remember to check back. A failed or unreachable webhook never breaks the run, it's reported as a warning in the output and costs nothing. Charged only on a confirmed delivery (see Pricing).

Pricing

  • $0.001 per input row processed (the primary event). Charged per row going in, not per group coming out, so a 5,000-row dataset costs the same $5.00 whether it collapses into 5 groups or 500.
  • $0.01 per exported file (CSV or Excel).
  • $0.02 per confirmed webhook delivery (only when your endpoint responds 2xx; a failed delivery costs nothing), effective 21 September 2026 and free before that.
  • Downloading a file by URL and appending to a named dataset are never charged. A small per-GB run-start fee (the platform default) applies.
  • Concretely: summarizing a 1,000-row scrape with both a CSV and an Excel download costs about $1.02. A weekly 500-row report with one CSV is about $0.51 per week.
  • From 21 September 2026, Apify Store discounts apply on every event: 10% off for Bronze, 20% for Silver and 30% for Gold accounts.

Works with the rest of the Nero Labs dataset toolkit

A common pipeline: a scraper, then Cleaner, then Filter & Transform, then Join to enrich from a sheet, then Aggregate for the weekly summary, with Diff watching what changed and Charts & Report turning the numbers into the Monday PDF. Pipeline Runner runs that whole chain in one call.

FAQ

My numbers are text, like "$1,234.50" or "49 USD". Will sum and average work? Yes, that is the default. Lenient number parsing handles currency symbols, thousands separators (both 1,234.56 and European 1.234,56), percent signs and accounting negatives like (300). Anything that genuinely is not a number is skipped and counted in the run summary, never silently treated as zero.

What happens to rows where the group field is empty or missing? They are grouped together under an explicit (blank) label, so they stay visible instead of disappearing. The summary also warns you if none of your rows has the field at all, which usually means a typo in the field name.

Can I get one row per month from a messy date field? Yes. Set the date bucket field to your date column and pick day, week, month, quarter or year. Unreadable dates land in an explicit (invalid date) group rather than being dropped.

Does this modify my original dataset? No. The source dataset (or file) is only read. The result goes to this run's own dataset and key-value store, plus a named dataset of your own if you set one. The one place data leaves your account is a Webhook URL you set yourself, which receives only that run's result.

My Google Sheet link gives an HTTP 401 or 403. The sheet isn't public. Set sharing to "Anyone with the link can view", or use File > Share > Publish to the web and paste that CSV link.

Is there a size limit? There is a hard safety ceiling of 200,000 input rows per run, and you can set your own lower cap with Maximum input rows as a cost guard.

If this Actor saved you a spreadsheet pivot session or a one-off GROUP BY script, a review on this page genuinely helps a small tool get found. If something did not work, open an issue in the Issues tab and you will get a personal reply.