HomeGuidesHow to Transpose a CSV File (Flip Rows and Columns)
Guide

How to Transpose a CSV File (Flip Rows and Columns)

3 methods — browser tool, Excel, and Python

Transposing a CSV rotates the data 90 degrees — rows become columns and columns become rows. This is useful when data arrives in a wide format (one row per metric, many columns per time period) but you need it in a long format for analysis, or vice versa.

Method 1: Using Tabular (browser, no software)

  1. 1Go to the Transpose tool on Tabular.
  2. 2Upload your CSV or XLSX file.
  3. 3Click Run — all rows become columns and all columns become rows.
  4. 4Download the transposed file.

After transposing, your original column headers become the first column. Use Tabular's Rename Columns tool to clean them up if needed.

Method 2: Using Excel (Paste Special)

  1. 1Open your CSV in Excel.
  2. 2Select all your data (Ctrl+A).
  3. 3Copy it (Ctrl+C).
  4. 4Click on an empty cell in a new sheet.
  5. 5Go to Home > Paste > Paste Special (or Ctrl+Alt+V).
  6. 6Check the 'Transpose' box and click OK.
  7. 7Save the new sheet as CSV via File > Save As.

Excel's Paste Special Transpose pastes values only — formulas are not transposed. This is exactly what you want for CSV data.

Method 3: Using Python (pandas)

  1. 1Install pandas: pip install pandas
  2. 2Run the script below.

python

import pandas as pd

df = pd.read_csv("input.csv")

# Transpose: rows become columns, columns become rows
df_transposed = df.T

# The original column headers become the index — reset to make them a regular column
df_transposed = df_transposed.reset_index()
df_transposed.columns = df_transposed.iloc[0]  # Use first row as header
df_transposed = df_transposed[1:]               # Drop the header row

df_transposed.to_csv("output.csv", index=False)

Frequently asked questions

What does it mean to transpose a CSV?

Transposing flips the orientation of a table: what were rows become columns, and what were columns become rows. A table with 5 rows and 10 columns becomes a table with 10 rows and 5 columns after transposing.

When would I need to transpose a CSV?

Common scenarios: (1) Survey or report exports where metrics are rows and dates are columns — but your BI tool needs dates as rows. (2) Wide-format data that needs to be in long format for database import. (3) Pivot table exports that need to be rotated for further processing.

What happens to the column headers when I transpose?

The original column headers (first row) become the first column after transposing. The original first column becomes the new header row. You may need to rename or clean up headers after transposing.

Can I transpose a very large CSV file?

Transposing large files is memory-intensive because the entire dataset must be loaded at once. Tabular supports files up to 50 MB on the Pro plan. For larger files, use the Python method on a machine with sufficient RAM.

Ready to try the fastest method?

Rotate your data 90°: rows become columns and columns become rows. Instantly reshape wide data into tall format or vice versa.

Transpose — free