Menu

Search toolsChangelog

to move to openDescribe the problem, not the tool

Reorder CSV Columns Without Excel

Enter the headings in the desired output order, one per line. For a position-only workflow, #3 followed by #1 and #2 moves the third column to the front. Every data row follows the same mapping, and cells containing separators, quotes or line breaks are escaped again when the new file is written.

A UTF-8 CSV, TSV or delimited text file up to 20 MB. It stays in this tab.

One exact heading per line, or positions such as #1 and #3. Leave blank to keep every column. Reorder the lines to reorder the output.

Turn this off for headerless data, then select columns only by # position.

Rows written
Data rows only; the header is not counted.
Columns kept
Columns in source
Output separator
What to take away
  1. The order of the keep-list is the order of the downloaded columns.

  2. Positions are one-based so #1 means the first visible spreadsheet column.

  3. The source file remains unchanged and never leaves the device.

How it works

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.

What it assumes

  • 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.

Common questions

Can I mix heading names and # positions?

Yes. Each line is resolved independently, so Email, #1 and Country can be used together. Selecting the same source column twice is refused rather than creating an accidental duplicate.

Can the reordered file use tabs instead of commas?

Yes. Choose tab output to download a .tsv file. The same quoting-aware parser is used for comma, semicolon, tab and pipe input.

Sources

The full method, worked example and every assumption behind this figure are on CSV Column Selector.