# Summarise a CSV or Google Sheet by URL (Group By)

**Use case:** 

Load a public CSV, Excel, JSON file or Google Sheet by link and group it: here the open ISO country-codes CSV on GitHub, grouped by continent with a country count, the number of distinct currencies and the lowest dial code per continent, sorted by size, downloaded as CSV and Excel. Swap in your own file or sheet link and field names.

## Input

```json
{
  "fileUrl": "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv",
  "data": [
    {
      "orderId": 1001,
      "region": "North",
      "product": "Widget",
      "amount": "$1,200.00",
      "orderedAt": "2026-07-03"
    },
    {
      "orderId": 1002,
      "region": "North",
      "product": "Gadget",
      "amount": 350,
      "orderedAt": "2026-07-18"
    },
    {
      "orderId": 1003,
      "region": "South",
      "product": "Widget",
      "amount": "890.50",
      "orderedAt": "2026-07-22"
    },
    {
      "orderId": 1004,
      "region": "south",
      "product": "Gizmo",
      "amount": 120,
      "orderedAt": "2026-08-02"
    },
    {
      "orderId": 1005,
      "region": "East",
      "product": "Widget",
      "amount": 2400,
      "orderedAt": "2026-08-05"
    },
    {
      "orderId": 1006,
      "region": "East",
      "product": "Gadget",
      "amount": "n/a",
      "orderedAt": "2026-08-09"
    },
    {
      "orderId": 1007,
      "region": "North",
      "product": "Gizmo",
      "amount": 75,
      "orderedAt": "2026-08-11"
    },
    {
      "orderId": 1008,
      "region": "",
      "product": "Widget",
      "amount": 410,
      "orderedAt": "2026-08-14"
    }
  ],
  "fileFormat": "auto",
  "groupByFields": [
    "Continent"
  ],
  "aggregations": [
    {
      "function": "count",
      "alias": "countries"
    },
    {
      "field": "ISO4217-currency_alphabetic_code",
      "function": "countDistinct",
      "alias": "currencies"
    },
    {
      "field": "Dial",
      "function": "min",
      "alias": "lowest_dial_code"
    }
  ],
  "groupMatching": "normalized",
  "dateBucketGranularity": "month",
  "pivotFunction": "sum",
  "lenientNumbers": true,
  "sortBy": "countries",
  "sortDirection": "desc",
  "includeTotalsRow": true,
  "exportFormats": [
    "csv",
    "xlsx"
  ]
}
```

## Output

```json
{
  "region": {
    "label": "Region",
    "format": "text"
  },
  "orders": {
    "label": "Orders",
    "format": "number"
  },
  "total_amount": {
    "label": "Total amount",
    "format": "number"
  },
  "avg_amount": {
    "label": "Avg amount",
    "format": "number"
  }
}
```

## About this Actor

This example demonstrates how to use [Dataset Aggregate, Group By & Pivot](https://apify.com/nerolabs/dataset-aggregate-pivot.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/nerolabs/dataset-aggregate-pivot.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/nerolabs/dataset-aggregate-pivot.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
