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.
The order of the keep-list is the order of the downloaded columns.
Positions are one-based so #1 means the first visible spreadsheet column.
The source file remains unchanged and never leaves the device.
How it works
How it is done
- Decode the chosen file as UTF-8, recording and removing any leading byte-order mark while the rows are parsed.
- Use the selected input separator, or count commas, semicolons, tabs and pipes outside quotes in the first complete record to detect it.
- Parse fields with RFC-style quoting, so doubled quotes become one quote and separators or line breaks inside a quoted field remain cell text.
- Resolve each non-empty keep-list line against an exact trimmed heading or a one-based # position; a blank list selects every source position.
- Project the header and every data row onto the same ordered positions, padding a short row with empty cells rather than shifting later data.
- 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.