CSV rename columns
csv-rename-columns · version 1.0.0 · CSV & tables · free, no key needed
Rename CSV headers by an exact from/to mapping, preserving row cells and column order.
Use when you need to: csv rename columns · rename csv columns · rename csv headers.
Supported
- csv rename columns
- rename csv columns
- rename csv headers
Not supported
- fuzzy header matching
- case-insensitive rename
- infer new names
- drop columns
- reorder columns
- read files
- fetch urls
Behavior
- mapping is a list of 1 to 256 { from, to } pairs; from and to are non-empty strings of at most 256 bytes.
- from values must be unique and each must equal a current header exactly; to values must be unique.
- A from equal to to is a no-op for that column. Column order and cell strings are unchanged.
- After rename, headers must remain unique; a to value must not collide with an unrenamed header.
- An empty document without a header is rejected; a header-only document is renamed and keeps zero data rows.
- 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 256000mapping(array of object, required): min items 1; max items 256
Output
csv(string, required)
Limits
- max input bytes: 256000
- max data rows: 5000
- max columns: 256
- max header name bytes: 256
- max mapping entries: 256
- max output bytes: 256000
Example
Request input:
{
"csv": "id,name,note\n1,Ada,\"hello, world\"\n",
"mapping": [
{
"from": "name",
"to": "full_name"
},
{
"from": "id",
"to": "user_id"
}
]
}
Response:
{
"result": {
"csv": "user_id,full_name,note\n1,Ada,\"hello, world\"\n"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "csv-rename-columns",
"version": "1.0.0",
"input": {
"csv": "id,name,note\n1,Ada,\"hello, world\"\n",
"mapping": [
{
"from": "name",
"to": "full_name"
},
{
"from": "id",
"to": "user_id"
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/csv-rename-columns/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"csv":"id,name,note\n1,Ada,\"hello, world\"\n","mapping":[{"from":"name","to":"full_name"},{"from":"id","to":"user_id"}]}'
The machine-readable contract is at /v1/tools/csv-rename-columns/versions/1.0.0.
CLI
node cli.mjs run csv-rename-columns 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- 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.
- CSV fill defaults: Replace empty cells in named CSV columns with exact default strings.
- CSV group count: Count CSV rows by exact named-column tuples in first-seen order.
- CSV merge columns: Join named CSV columns with an exact separator into one column.