# CSV replace exact

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

Replace CSV data cells whose entire value equals an exact find string.

**Use when you need to: csv replace exact · replace exact csv cells · csv cell exact substitution.**

## Supported

- csv replace exact
- replace exact csv cells
- csv cell exact substitution

## Not supported

- substring replacement
- regex replacement
- case-insensitive replace
- header replacement
- text-replace-exact on the raw csv document
- trim cells
- read files
- fetch urls

## Behavior

- The first CSV record is the header row and is never rewritten. An empty document is rejected; a header-only document is identity CSV with replacements 0.
- A data cell is replaced only when the entire cell string equals find. Substring, regex, and case-folded matches are not applied.
- If columns is omitted, every data column is eligible. If present, columns names unique existing headers exactly and only those columns are scanned.
- find and replace may be empty. No trimming, type coercion, or locale compare is performed. replacements counts matching data cells, including identity replacements where find equals replace.
- The first output header name may not begin with U+FEFF because it is ambiguous with a CSV byte-order mark.

## Input

- `csv` (string, required): max length 256000
- `find` (string, required): max length 262144
- `replace` (string, required): max length 262144
- `columns` (array of string, optional): min items 1; max items 256; each min length 1; each max length 256

## Output

- `csv` (string, required)
- `replacements` (integer, required): min 0

## Limits

- max input bytes: 256000
- max data rows: 5000
- max columns: 256
- max header name bytes: 256
- max find bytes: 262144
- max replace bytes: 262144
- max output bytes: 256000

## Example

Request input:

```json
{
  "csv": "status,note\nok,ok\npending,ok\n",
  "find": "ok",
  "replace": "done"
}
```

Response:

```json
{
  "result": {
    "csv": "status,note\ndone,done\npending,done\n",
    "replacements": 3
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "csv-replace-exact",
  "version": "1.0.0",
  "input": {
    "csv": "status,note\nok,ok\npending,ok\n",
    "find": "ok",
    "replace": "done"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/csv-replace-exact/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"csv":"status,note\nok,ok\npending,ok\n","find":"ok","replace":"done"}'
```

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

### CLI

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

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

## Related tools

- [CSV fill defaults](/tools/csv-fill-defaults): Replace empty cells in named CSV columns with exact default strings.
- [CSV filter empty](/tools/csv-filter-empty): Keep or drop CSV rows whose named column is the empty string.
- [CSV split column](/tools/csv-split-column): Split one CSV column on an exact separator into uniquely named columns.
- [CSV abs integer column](/tools/csv-abs-integer-column): Replace every data cell in a named CSV column with the absolute value of a canonical integer.
- [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.
