# CSV Column Selector

> Keep a named or positional subset of a CSV, TSV or pipe-delimited file, reorder those columns, and download a new UTF-8 table without uploading the source or mistaking quoted punctuation for structure.

Use it: https://tessalor.com/en/data/csv-column-selector

This tool runs entirely in the browser. Nothing entered into it is uploaded.

## How it is done

1. Decode the chosen file as UTF-8, recording and removing any leading byte-order mark while the rows are parsed.
2. Use the selected input separator, or count commas, semicolons, tabs and pipes outside quotes in the first complete record to detect it.
3. Parse fields with RFC-style quoting, so doubled quotes become one quote and separators or line breaks inside a quoted field remain cell text.
4. Resolve each non-empty keep-list line against an exact trimmed heading or a one-based # position; a blank list selects every source position.
5. Project the header and every data row onto the same ordered positions, padding a short row with empty cells rather than shifting later data.
6. Escape the selected values for the requested separator, write CRLF record endings, restore the source byte-order mark when one existed and offer the new file locally.

## Assumptions

- Input text is decoded as UTF-8. Legacy Windows code pages need to be converted to UTF-8 first.
- The first row is treated as headings by default. Headerless files can be selected only with positions such as #1 and #3.
- Heading lookup trims outer whitespace but otherwise matches exactly and case-sensitively. Duplicate headings must be selected by position.
- The tool keeps and reorders complete columns; it does not rename headings, filter rows, infer data types or evaluate spreadsheet formulas.
- The 20 MB input, 500,000-row, 5,000-column and 64 MB output limits keep the complete in-browser operation bounded.
- Equivalent delimited files may use different quoting and record endings. Selected decoded cell values are preserved, not the original bytes.

## Inputs

| Name | Label | Type | Default | Range |
| --- | --- | --- | --- | --- |
| `source` | CSV file | file | chosen on your device | text/csv, text/plain, text/tab-separated-values, up to 20 MB |
| `columns` | Columns to keep, in output order | textarea |  |  |
| `header` | The first row is a header | toggle | true |  |
| `delimiter` | Input separator | select | auto |  |
| `outputDelimiter` | Output separator | select | same |  |

## Outputs

- `rows` — Rows written (integer), primary
- `columnsKept` — Columns kept (integer)
- `inputColumns` — Columns in source (integer)
- `separator` — Output separator (text)

## Questions

### Is the CSV uploaded before its columns are removed?

No. A worker in this browser tab reads, parses and rewrites the selected file. The page's browser test loads a real CSV and fails if any request leaves the site while the file is present.

### How do I select one of two columns with the same heading?

Use its one-based position, such as #2. A repeated heading is deliberately treated as ambiguous instead of silently selecting the first copy.

### Will quoted commas or line breaks break the new file?

No. A separator or line break between quotes remains part of one cell, and two consecutive quotes become one literal quote. When the selected columns are written, any value that needs quoting is escaped again.

### Does the selector protect cells from spreadsheet formulas?

It does not alter cell text, because this is a positional selection rather than a sanitising export. Treat a file from an untrusted source as untrusted when opening it in spreadsheet software.

## Sources

- [RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files](https://www.rfc-editor.org/rfc/rfc4180) — Internet Engineering Task Force, applies to Records, fields, double-quote escaping and CRLF output. Retrieved 2026-08-01.
- [Model for Tabular Data and Metadata on the Web](https://www.w3.org/TR/tabular-data-model/) — World Wide Web Consortium, applies to Ordered rows, columns, source numbers and named columns. Retrieved 2026-08-01.
- [Encoding Standard — UTF-8 decoder](https://encoding.spec.whatwg.org/#utf-8-decoder) — WHATWG, applies to UTF-8 decoding and byte-order-mark handling. Retrieved 2026-08-01.

## Variants

- [How do I keep only some columns from a CSV file?](https://tessalor.com/en/data/csv-column-selector/keep-only-some-columns-from-csv)
- [How do I reorder CSV columns without Excel?](https://tessalor.com/en/data/csv-column-selector/reorder-csv-columns-without-excel)

---

Estimate, not advice. See https://tessalor.com/en/disclaimer.
Machine-readable catalogue: https://tessalor.com/api/tools.json
