2 min read
By HappyCSV Team

Transposing CSV Data (Rotate Rows to Columns)

How to transpose CSV files—swapping rows and columns. Use Excel Paste Special, Python Pandas, or online tools to reshape your data.

Transposing CSV Data (Rotate Rows to Columns)

Sometimes your data is "wide" when it needs to be "tall", or vice versa.

Original (Wide):

Name,Jan,Feb,Mar
Sales,100,200,150
Costs,50,60,55

Transposed (Tall):

Name,Sales,Costs
Jan,100,50
Feb,200,60
Mar,150,55

This operation is called Transposing.

Method 1: Excel "Paste Special"

  1. Open CSV in Excel.
  2. Select all data (Ctrl+A).
  3. Copy (Ctrl+C).
  4. Click on an empty cell (or new sheet).
  5. Right-click > Paste Special.
  6. Check the Transpose box (bottom right).
  7. Click OK.

Pros: Visual, easy. Cons: Manual; limited by Excel's row/column limits.

Method 2: Python (Pandas)

One line of code.

import pandas as pd

df = pd.read_csv('data.csv', header=None) # header=None if you want to rotate headers too
df_transposed = df.T
df_transposed.to_csv('transposed.csv', header=False, index=False)

Method 3: Online Tool

If you don't have Excel or Python handy.

-> Transpose CSV Tool

When to Transpose?

  • Charting: Chart tools often expect time series in rows, not columns.
  • Database Import: Databases prefer "Tall" data (normalized) over "Wide" matrices.
  • Comparison: It's often easier to compare metrics side-by-side (columns) than row-by-row.

Warning: Header Confusion

When you transpose, your Headers become the first Column. And your first Column becomes the Headers.

Ensure your data makes sense after rotation. You might need to rename the new header row manually.


Need to rotate data? HappyCSV can transpose your CSV file in seconds directly in the browser.

Need to handle CSV files?

HappyCSV is the free, secure way to merge, split, and clean your data — all in your browser.