# CSV concat

`csv-concat` · version 1.0.0 · CSV & tables · free, no key needed

Concatenate CSV documents that share identical headers, preserving document and row order.

**Use when you need to: csv concat · concatenate csv documents · append csv rows with matching headers.**

## Supported

- csv concat
- concatenate csv documents
- append csv rows with matching headers
- stack csv documents

## Not supported

- union mismatched schemas
- reorder columns to match
- fuzzy header matching
- case-insensitive headers
- read files
- fetch urls

## Behavior

- documents is an array of 2 to 20 CSV strings; each string is bounded by the CSV byte limit.
- The first document supplies the output headers; every later document must have the same header names in the same order.
- An empty document without a header row is rejected; a header-only document contributes zero data rows.
- Output data rows follow document order, then row order within each document. Cells are not trimmed, case-folded, or type-coerced.
- The combined data-row count must not exceed the CSV row limit.
- The first output header name may not begin with U+FEFF because it is ambiguous with a CSV byte-order mark.

## Input

- `documents` (array of string, required): min items 2; max items 20; each max length 256000

## Output

- `csv` (string, required)
- `documents_in` (integer, required)
- `rows_out` (integer, required)

## Limits

- min documents: 2
- max documents: 20
- max input bytes: 256000
- max data rows: 5000
- max columns: 256
- max header name bytes: 256
- max output bytes: 256000

## Example

Request input:

```json
{
  "documents": [
    "id,name,note\n1,Ada,\"hello, world\"\n",
    "id,name,note\n2,Lin,later\n"
  ]
}
```

Response:

```json
{
  "result": {
    "csv": "id,name,note\n1,Ada,\"hello, world\"\n2,Lin,later\n",
    "documents_in": 2,
    "rows_out": 2
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "csv-concat",
  "version": "1.0.0",
  "input": {
    "documents": [
      "id,name,note\n1,Ada,\"hello, world\"\n",
      "id,name,note\n2,Lin,later\n"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/csv-concat/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"documents":["id,name,note\n1,Ada,\"hello, world\"\n","id,name,note\n2,Lin,later\n"]}'
```

The machine-readable contract is at [/v1/tools/csv-concat/versions/1.0.0](/v1/tools/csv-concat/versions/1.0.0).

### CLI

```sh
node cli.mjs run csv-concat 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [CSV add row number](/tools/csv-add-row-number): Prepend a 1-based row_number column of canonical integer strings.
- [CSV anti join](/tools/csv-anti-join): Keep left CSV rows whose exact key tuples do not appear in the right document.
- [CSV dedupe](/tools/csv-dedupe): Remove duplicate CSV data rows while preserving the first occurrence.
- [CSV fill defaults](/tools/csv-fill-defaults): Replace empty cells in named CSV columns with exact default strings.
- [CSV group count](/tools/csv-group-count): Count CSV rows by exact named-column tuples in first-seen order.
- [CSV inner join](/tools/csv-inner-join): Inner join two CSV documents on exact named key columns.
