---
title: "data.consolidate: Consolidate — Sheet kit command — Kition"
description: "Combines several source ranges into one at a destination with a function (sum, average, count…), matching by top row and left column labels when asked."
canonical: "https://developer.kition.ai/docs/kits/sheet/commands/data.consolidate"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/sheet/commands/data.consolidate](https://developer.kition.ai/docs/kits/sheet/commands/data.consolidate)

# data.consolidate

**Consolidate.** Combines several source ranges into one at a destination with a function (sum, average, count…), matching by top row and left column labels when asked.

- Kit: Sheet 0.1.0 (.xlsx (and opens .xlsm, .xls, .xltx, .csv, .ods, .xlsb)); reference: [Sheet kit commands](https://developer.kition.ai/docs/kits/sheet.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `destination` | `string` | no | like A1; default active cell |
| `function` | `string` | no |  |
| `leftColumn` | `boolean` | no | consolidate by labels; else by position |
| `sources` | `any[]` | no | ["Sheet2!A1:C10", ..] |
| `topRow` | `boolean` | no |  |

## Call through sheet_run

```text
sheet_run {
  "path": "<file>.xlsx",
  "steps": [{ "command": "data.consolidate" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `destination`, `function`, `leftColumn`, `sources`, `topRow`. sheet_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "destination": {
      "description": "like A1; default active cell",
      "type": "string"
    },
    "function": {
      "type": "string"
    },
    "leftColumn": {
      "description": "consolidate by labels; else by position",
      "type": "boolean"
    },
    "sources": {
      "description": "[\"Sheet2!A1:C10\", ..]",
      "type": "array"
    },
    "topRow": {
      "type": "boolean"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/sheet-darwin-arm64@0.1.0 and the kit itself (sheet_commands through @kition/cli@0.1.1, built from KitionAI/kition-sheet@82f13b2).
