TBToolbox
Developer Tools

CSV Sorter

CSV Sorter finds the first exact header, preserves it, and sorts data rows by that cell using localeCompare with numeric=true. Values remain strings; blanks follow locale behavior, and there are no descending, secondary-key, case, locale, type, or duplicate-header controls.

Runs locally — files stay on your device
Quick answer

Are values parsed as numbers?

No, but numeric-aware string comparison is requested.

Natural string sorting is not typed sorting

Numeric comparison options can place item2 before item10, while dates and localized numbers still need parsing rules.

How it works

The header index is found, rows sort on cell text, then CSV escaping writes output.

Key concepts

Exact header

Case and spaces must agree.

Rows move whole

All cells follow their sort key.

When to use it

  • Sort a small CSV by a known column.
  • Create natural-order review output.
  • Keep records intact while ordering.

When not to use it

  • Do not expect descending or multi-column sort.
  • Do not sort dates without normalization.
  • Do not use duplicate headers.

Worked examples

Natural

Input
id\n10\n2
Expected output
2 before 10

numeric option.

Missing header

Input
Name vs name
Expected output
Error

Exact match.

Blank

Input
Missing sort cells
Expected output
Locale-dependent position

No blank policy.

Common mistakes

Expecting number conversion

Cells stay strings. Correction: Normalize types.

Wrong casing

Header lookup fails. Correction: Copy exact header.

Assuming locale stability

Default locale is used. Correction: Use explicit collation.

Best practices

  • Validate header uniqueness.
  • Normalize the sort field.
  • Verify ordering.

Related operations and differences

CSV Column Extractor

Choose CSV Column Extractor when you need to extract one CSV column by header name.; use CSV Sorter specifically for csv sort.

CSV Column Remover

Choose CSV Column Remover when you need to remove one CSV column by header name.; use CSV Sorter specifically for csv sort.

CSV Duplicate Remover

Choose CSV Duplicate Remover when you need to remove completely duplicated CSV rows.; use CSV Sorter specifically for csv sort.

CSV Row Filter

Choose CSV Row Filter when you need to keep rows whose selected column contains a value.; use CSV Sorter specifically for csv sort.

Reverse CSV Rows

Choose Reverse CSV Rows when you need to reverse data-row order while keeping the header.; use CSV Sorter specifically for csv sort.

Compare JSON

Choose Compare JSON when you need to show value differences between two JSON documents.; use CSV Sorter specifically for csv sort.

Limitations and privacy

  • One ascending column only; no explicit locale, descending, secondary keys, typed parser, blank policy, duplicate warning, or streaming.

The pasted data is parsed and transformed locally in this browser.

Frequently asked questions

Is the header sorted?

No.

Can I sort descending?

No.

Is matching case-sensitive?

Yes.

Are rows kept intact?

Yes.

References