CSV Row Counter
Count CSV records including blank records and quoted multiline fields, with an explicit header flag; physical lines are not records.
Description
CSV row counting should use parsed records rather than physical lines.
CSV row counting should use parsed records rather than physical lines. Blank records count, while quoted multiline cells remain inside their record.1
Count CSV records including blank records and quoted multiline fields, with an explicit header flag; physical lines are not records.
When to use CSV Row Counter
Use this for the following task: Count CSV records including blank records and quoted multiline fields, with an explicit header flag; physical lines are not records.
Prepare the CSV text, decoded cells or byte values requested below. Choose delimiter and header flags explicitly when those fields are present.
How to use CSV Row Counter and understand its results
- Prepare the CSV text, decoded cells or byte values requested below. Choose delimiter and header flags explicitly when those fields are present.
- Enter csv, delimiter, hasHeader using the field table, then run the tool.
- Read recordCount, dataRowCount. Interpret flags, units, ordering and placeholder values using the rules below.
- Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| csv | CSV text | string; maximum text length 100000 | Required |
| delimiter | Delimiter | string; choose ",", ";", "\t" | Required |
| hasHeader | Has header | boolean | Required |
Parse records and apply the explicit header flag. Reject empty input when a header is required; otherwise empty text yields zero counts.2
Parse delimiters only outside quoted fields and decode doubled quotes. A quoted line break stays inside its cell; malformed quoting is returned as an input error.
recordCount = parsed records; dataRowCount = recordCount−1 if hasHeader This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.
| Output field | Meaning | Value type |
|---|---|---|
| recordCount | Record count | integer |
| dataRowCount | Data row count | integer |
{
"input": {
"csv": "name,note\nAda,\"one\ntwo\"",
"delimiter": ",",
"hasHeader": true
},
"output": {
"recordCount": 2,
"dataRowCount": 1
}
} Limitations and assumptions
A terminal record ending does not create an extra row. No header detection or blank-record removal is performed.
Where CSV is parsed, the shared parser accepts comma, semicolon or tab separators, doubled quotes and quoted line breaks, with CR/LF/CRLF record endings. Blank records remain records. CSV inputs are bounded to 100000 UTF-16 units and 10000 fields. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.
Alternative or Complementary methods
Choose Line Count vs Record Count Reconciler for this operation: Compare physical CSV line count with logical record count, treating CRLF as one break and a terminal ending as no extra line; embedded quoted breaks explain the excess physical lines. For a complementary task, use Row Head/Tail Slice N for this operation: Take the first or last N CSV data records in their original order, retaining an explicitly declared header and treating quoted multiline cells as one record.
Further background: Format and language reference: CSV Row Counter.
References
-
Format and language reference: CSV Row Counter — RFC Editor
-
CSV Row Counter — tool.io
Similar or alternative tools
- Line Count vs Record Count Reconciler
Compare physical CSV line count with logical record count, treating CRLF as one break and a terminal ending as no extra line; embedded quoted breaks explain the excess physical lines.
- Row Head/Tail Slice N
Take the first or last N CSV data records in their original order, retaining an explicitly declared header and treating quoted multiline cells as one record.