Data · 25 tools · nothing uploads

Transpose CSV

Swap a CSV's rows and columns. Column 1 becomes row 1, and so on. A ragged row (fewer cells than the widest row) is padded with empty cells rather than refused. Quote-aware. A record with a quoted field containing a literal newline stays one record, not two. Runs entirely on your device.

Input

live

Transpose CSV swaps a file's rows and columns, writing the flipped grid out as -transposed.csv. Width comes from the file's widest row, and shorter rows are padded with empty cells. There are no options, and the header is turned like any other row, so the output has no header of its own.

Questions

What does transposing do to my file?

It swaps rows and columns. The first column becomes the first row, the second column becomes the second row, and so on. A file of 3 rows by 5 columns comes back as 5 rows by 3 columns, and the result line states both shapes so you can confirm it did what you expected.

Is the header treated specially?

No. There is no header option here, so the header row is transposed like any other row and becomes the first column of the output. That is usually what you want for a table you are pivoting by hand, but it does mean the result has no header row of its own.

What happens if my rows are different lengths?

Short rows are padded with empty cells rather than refused. The output width is set by the widest row in the file, and every gap is filled with an empty string, so the result is a proper rectangle. To find those ragged rows before transposing, run Find incomplete CSV records.

Will a cell containing a newline survive?

Yes. Records are parsed with quote state tracked across the whole text, so a quoted field with a literal newline inside it stays one cell rather than becoming two rows. When the transposed grid is written back out, any cell that needs quotes gets them again.

Are there any settings?

None. The tool takes one file and does one thing, so the result is the same every time you run it on the same input. Run it twice and you are back where you started. There is no delimiter option either, so a semicolon separated file should go through Change CSV separator first.

How large a file can I transpose?

There is no fixed limit, but the whole grid is held in memory and a second, transposed grid is built beside it, so a wide or tall file needs roughly twice its size in memory. Everything happens in your browser with nothing uploaded, so your own device sets the ceiling. The output is named with -transposed.csv on the end.

Related Data tools

1→1Reorder / insert CSV columnsReorder (and drop) a CSV's columns by name, and optionally insert one new column with a constant value at a given position. Quote-aware. A record with a quoted field containing a literal newline stays one record.Takes one file1→1Map CSV column namesRename a CSV's header to a new schema ("old=new" pairs), and optionally drop every column that isn't named in the mapping. Column order and data are otherwise untouched. Quote-aware. A record with a quoted field containing a literal newline stays one record.Takes one file1→1Change CSV separatorRe-delimit a CSV (comma, semicolon, tab or pipe), auto-detecting the current separator when not told what it is. Quote-aware. A record with a quoted field containing a literal newline (including in the header) stays one record.Takes one file1→1Split CSV into partsCut a CSV into several smaller files of N data rows each, repeating the header in every part. Quote-aware: a record with a quoted field containing a literal newline stays one record.Takes one filen→1Merge CSV filesConcatenate several CSVs with the same header into one file, in the order given. Quote-aware. A record with a quoted field containing a literal newline stays one record.Combines the files you drop1→1Remove duplicate CSV rowsStrip repeated rows from a CSV. Compares whole records, not physical lines, so a quoted field containing a newline is one record and stays one record.Takes one file1→1Find incomplete CSV recordsReport every record whose cell count doesn't match the header: too few cells (a truncated record) or too many (an unescaped comma). Read-only: nothing is changed. Quote-aware, so a record with a quoted field containing a literal newline still counts as one record with the right cell count.Takes one file1→1CSV to tableConvert a CSV to markdown, HTML, LaTeX, SQL INSERT statements, JSON, YAML, or Jira table markup. The first row is always the header (object keys for JSON); every format quotes its own special characters.Takes one file