CSV fill defaults
csv-fill-defaults · version 1.0.0 · CSV & tables · free, no key needed
Replace empty cells in named CSV columns with exact default strings.
Use when you need to: csv fill defaults · fill empty csv cells with defaults · replace empty csv cells.
Supported
- csv fill defaults
- fill empty csv cells with defaults
- replace empty csv cells
- csv fill empty columns
Not supported
- trim cells before filling
- fill whitespace-only cells
- infer defaults
- fuzzy column matching
- type coercion
- read files
- fetch urls
Behavior
- The first CSV record is the header row.
- defaults own keys must name existing headers exactly; unknown columns are rejected.
- Only cells whose string length is 0 are replaced; whitespace-only cells are left unchanged.
- An empty default string is a no-op and does not increment cells_filled.
- Other columns and non-empty cells are preserved without trimming or type coercion.
- An empty document without a header is rejected when defaults is non-empty; a header-only document yields header-only output.
- 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 256000defaults(object, required)
Output
csv(string, required)cells_filled(integer, required): min 0
Limits
- max input bytes: 256000
- max data rows: 5000
- max columns: 256
- max header name bytes: 256
- max default columns: 256
- max output bytes: 256000
Example
Request input:
{
"csv": "name,city,status\nAda,,\n,London,ok\n",
"defaults": {
"name": "Anonymous",
"city": "Unknown",
"status": "pending"
}
}
Response:
{
"result": {
"csv": "name,city,status\nAda,Unknown,pending\nAnonymous,London,ok\n",
"cells_filled": 3
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "csv-fill-defaults",
"version": "1.0.0",
"input": {
"csv": "name,city,status\nAda,,\n,London,ok\n",
"defaults": {
"name": "Anonymous",
"city": "Unknown",
"status": "pending"
}
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/csv-fill-defaults/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"csv":"name,city,status\nAda,,\n,London,ok\n","defaults":{"name":"Anonymous","city":"Unknown","status":"pending"}}'
The machine-readable contract is at /v1/tools/csv-fill-defaults/versions/1.0.0.
CLI
node cli.mjs run csv-fill-defaults 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- CSV filter empty: Keep or drop CSV rows whose named column is the empty string.
- CSV merge columns: Join named CSV columns with an exact separator into one column.
- CSV replace exact: Replace CSV data cells whose entire value equals an exact find string.
- CSV concat: Concatenate CSV documents that share identical headers, preserving document and row order.
- CSV dedupe: Remove duplicate CSV data rows while preserving the first occurrence.
- CSV drop columns: Drop named CSV columns and keep the remaining columns in original header order.