Transpose a Table: Turn Rows into Columns
Transposing a table swaps its axes: the first row becomes the first column and vice versa. It is the fix when a table is laid out the wrong way for your tool, for example a wide table of one record per column that you want as one record per row.
Why it matters
Some tables are laid out with data in rows; others are laid out with data in columns. Most tools and charting software expect records to sit in rows, with each column representing a field. When a table is transposed (one record per column instead), you need to flip it before using it.
For example, a financial report might have years across the top as columns and expense categories down the left as rows. That's wide and short. A spreadsheet pivot tool expecting records in rows would need to see each year as a separate row. Transposing the table solves that mismatch in one click.
How it works
Transpose swaps the row and column indices. Every cell at position (row, column) in the original table moves to (column, row) in the result. Mathematically, it's a simple operation, but it changes which axis represents records and which represents fields.
Before transpose:
- Row 1 has Jan, Feb, Mar, Apr (the time axis)
- Column A has 2024, 2025, 2026 (the year axis)
After transpose:
- Row 1 has 2024, 2025, 2026 (the year axis moves to a row)
- Column A has Jan, Feb, Mar, Apr (the time axis moves to a column)
Scalpel handles ragged rows automatically. If some rows have fewer columns than others, the transpose pads them with blanks so the result stays rectangular. A table that was uneven becomes even after the flip.
The transpose toggle on the table card applies the flip to every export and preview you make. Turn it on, and every copy, download, and Markdown version uses the transposed shape. The effect is immediate.
What does not matter
Transpose doesn't change the data inside the cells, only the grid shape. A number stays the same; a date stays the same. Only the position moves.
What becomes ambiguous after a transpose is which row is the header. If the original table had a header row, that row becomes a column after flipping. Scalpel still respects your "First row is header" setting, but what counts as "first row" changes. You might need to adjust the header setting after transposing to make sure Markdown and rich exports look right.
Also, transpose works best on rectangular tables. If a table has merged cells (colspan or rowspan) that aren't symmetric, the transpose might produce unexpected results. Scalpel tries to expand merged cells first so the table is rectangular, then transposes.
Code example
Original table (years in columns, expense categories in rows):
2024 2025 2026
Salaries $500k $525k $551k
Infrastructure $150k $180k $200k
Marketing $75k $90k $100k
After transpose (years in rows, expense categories in columns):
Salaries Infrastructure Marketing
2024 $500k $150k $75k
2025 $525k $180k $90k
2026 $551k $200k $100k
The same 12 data points sit in a 3x4 table before and a 4x3 table after. Everything else is identical.
How Scalpel shows it
The Transpose toggle sits in the table card's footer, next to the "First row is header" control. It's an on/off switch. When on, a "T" flag appears on the table card to remind you the layout is flipped. The preview updates immediately to show the transposed shape. Every export then uses the transposed grid.
Toggle it back off and the table returns to its original orientation.