CSV slice rows
csv-slice-rows · version 1.0.0 · CSV & tables · free, no key needed
Take a contiguous window of CSV data rows by offset and limit, keeping the header.
Use when you need to: csv slice rows · slice csv rows · csv row window.
Supported
- csv slice rows
- slice csv rows
- csv row window
Not supported
- negative indexes
- wrap-around slicing
- sample random rows
- filter by key
- read files
- fetch urls
Behavior
- offset and limit are JSON integers with Number.isInteger; each is between 0 and 5000 inclusive.
- Data rows are sliced as the half-open interval [offset, offset + limit) without wrapping or negative-from-end indexes.
- If offset is past the last data row, the header is kept and zero data rows are returned.
- An empty document without a header is rejected; a header-only document returns the header and rows_out 0 for any valid offset and limit.
- Cell strings are preserved without trimming, case folding, or type coercion.
- 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 256000offset(integer, required): min 0; max 5000limit(integer, required): min 0; max 5000
Output
csv(string, required)rows_in(integer, required): min 0rows_out(integer, required): min 0
Limits
- max input bytes: 256000
- max data rows: 5000
- max columns: 256
- max header name bytes: 256
- max offset: 5000
- max limit: 5000
- max output bytes: 256000
Example
Request input:
{
"csv": "id,name\n1,Ada\n2,Lin\n3,Zoe\n",
"offset": 1,
"limit": 1
}
Response:
{
"result": {
"csv": "id,name\n2,Lin\n",
"rows_in": 3,
"rows_out": 1
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "csv-slice-rows",
"version": "1.0.0",
"input": {
"csv": "id,name\n1,Ada\n2,Lin\n3,Zoe\n",
"offset": 1,
"limit": 1
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/csv-slice-rows/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"csv":"id,name\n1,Ada\n2,Lin\n3,Zoe\n","offset":1,"limit":1}'
The machine-readable contract is at /v1/tools/csv-slice-rows/versions/1.0.0.
CLI
node cli.mjs run csv-slice-rows 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- CSV add row number: Prepend a 1-based row_number column of canonical integer strings.
- CSV row diff: Compare two CSV documents with identical headers by unique key tuples and report added, removed, and changed rows.
- CSV anti join: Keep left CSV rows whose exact key tuples do not appear in the right document.
- 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 group count: Count CSV rows by exact named-column tuples in first-seen order.