CSV Transposer
Swap CSV rows and columns and download the result
CSV Transposer — what it does
Swap rows and columns so the first column becomes the header row and each original row becomes a column. Transposing is the fix for data that arrived in the wrong orientation — metrics running across the page instead of down it — which no amount of filtering or sorting can correct.
Worked example
A five-person staff list turned on its side so each person becomes a column, the layout a side-by-side comparison sheet usually wants.
Input — contacts.csv
name,email,department,start_date,salary Ann Lee,ann.lee@example.com,Sales,2021-03-15,52000 Ben Ortiz,ben.ortiz@example.com,Engineering,2019-11-02,88000 Chloe Park,chloe.park@example.com,Sales,2023-06-01,47500 Dev Patel,dev.patel@example.com,Support,2020-01-20,41000 Emma Rossi,emma.rossi@example.com,Engineering,2022-09-12,91000
Output — transposed.csv
name,Ann Lee,Ben Ortiz,Chloe Park,Dev Patel,Emma Rossi email,ann.lee@example.com,ben.ortiz@example.com,chloe.park@example.com,dev.patel@example.com,emma.rossi@example.com department,Sales,Engineering,Sales,Support,Engineering start_date,2021-03-15,2019-11-02,2023-06-01,2020-01-20,2022-09-12 salary,52000,88000,47500,41000,91000
The status reads 6 × 5 → 5 × 6 because the header counts as a row. The former header name lands in the first cell, and the download is always transposed.csv.
When this tool helps
- Reorienting a report where each month is a column and each metric is a row, into one row per month.
- Converting a wide survey export into the tall format most analysis and charting tools expect.
- Turning a single-record vertical listing of field names and values into a normal tabular row.
How to use it
- Choose the CSV file.
- Press transpose.
- Check that the new header row reads correctly.
- Download the transposed CSV.
Accuracy, limits, and good practice
- The first column becomes your header, so make sure its values are unique — repeated labels create duplicate headers downstream.
- Transposing a file with many rows produces a file with many columns, which spreadsheets handle badly beyond a few hundred.
- Mixed data types end up sharing a column after transposition, so a column may hold both dates and amounts. Check before aggregating.
Frequently asked questions
Is transposing reversible?
Yes. Transposing the result again returns the original layout, apart from any header renaming the first pass introduced.
Do blank cells cause problems?
No, they transpose as blanks. Rows of differing length are padded so the resulting grid stays rectangular.
Why does my data look wrong afterwards?
Usually the source had no meaningful first column to serve as headers. Add a label column before transposing.
Does the tool need a header row?
No. It has no notion of a header — every line, including the first, is treated the same way, so a file without headers transposes just as well. The row count in the status therefore includes the header line.
What if rows have different lengths?
The output is sized to the longest row; shorter rows contribute empty cells, so the transposed file is always rectangular, and cells containing commas, quotes or line breaks are re-quoted on output.
Related tools on this site
- CSV Column Reorder — Change CSV column order before downloading
- Merge CSV Files — Combine multiple CSV files into one table
- CSV to Markdown Table — Convert a CSV file into a Markdown table
Further reading: Cleaning a CSV export before you import it anywhere · CSV, JSON, YAML, XML and Markdown Tables: When Each Fits and How to Convert
Everything above runs inside this page. CSV Transposer needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
CSV 行列互換能做什麼
交換列與欄,讓第一欄變成標題列,原本的每一列變成一欄。當資料的方向本來就錯了——指標橫著排而不是直著排——再多的篩選或排序都救不回來,行列互換才是解法。
實際範例
五人的員工名單轉成橫向,每個人各佔一欄,正是並排比較表常見的版面。
來源:contacts.csv
name,email,department,start_date,salary Ann Lee,ann.lee@example.com,Sales,2021-03-15,52000 Ben Ortiz,ben.ortiz@example.com,Engineering,2019-11-02,88000 Chloe Park,chloe.park@example.com,Sales,2023-06-01,47500 Dev Patel,dev.patel@example.com,Support,2020-01-20,41000 Emma Rossi,emma.rossi@example.com,Engineering,2022-09-12,91000
得到:transposed.csv
name,Ann Lee,Ben Ortiz,Chloe Park,Dev Patel,Emma Rossi email,ann.lee@example.com,ben.ortiz@example.com,chloe.park@example.com,dev.patel@example.com,emma.rossi@example.com department,Sales,Engineering,Sales,Support,Engineering start_date,2021-03-15,2019-11-02,2023-06-01,2020-01-20,2022-09-12 salary,52000,88000,47500,41000,91000
狀態列顯示 6 × 5 → 5 × 6,因為標題列也算一列。原本的欄名 name 落在第一個儲存格,下載檔一律叫 transposed.csv。
什麼時候用得上
- 把「每月一欄、每個指標一列」的報表,轉成每月一列的格式。
- 把寬式問卷匯出檔轉成多數分析與繪圖工具偏好的長式格式。
- 把單筆紀錄的直式欄名與值清單,轉回正常的表格列。
使用步驟
- 選擇 CSV 檔案。
- 按下行列互換。
- 確認新的標題列是否正確。
- 下載互換後的 CSV。
精確度、限制與實務建議
- 第一欄會變成標題,請確認其值唯一;重複的標籤會在下游造成重複標題。
- 列數很多的檔案轉換後會變成欄數很多,超過數百欄時試算表的處理體驗會很差。
- 互換後不同型別的資料可能落在同一欄,例如日期與金額混在一起,彙總前請先確認。
常見問題
行列互換可以還原嗎?
可以,再互換一次即回到原本配置,只有第一次造成的標題改寫需自行還原。
空白儲存格會有問題嗎?
不會,空白照樣互換;長度不一的列會補齊,確保結果維持矩形結構。
為什麼互換後資料看起來怪怪的?
通常是原始檔案的第一欄不適合當標題。請先加上一欄標籤再互換。
需要有標題列嗎?
不需要。這個工具沒有標題列的概念,包括第一行在內每一行都一視同仁,沒有標題的檔案一樣能轉。狀態列的列數因此把標題行也算進去。
各列長度不一會怎樣?
以最長的列為準,較短的列以空儲存格補齊,轉置後的檔案永遠是矩形;含逗號、引號或換行的儲存格寫回時會重新加上引號。
本站相關工具
- CSV 欄位重新排序 — 調整 CSV 欄位順序後下載
- 合併 CSV 檔案 — 將多個 CSV 檔案合併成同一張表格
- CSV 轉 Markdown 表格 — 將 CSV 檔案轉成 Markdown 表格
延伸閱讀: 匯入之前先把 CSV 匯出檔清乾淨 · CSV、JSON、YAML、XML 與 Markdown 表格:各自適用的場合與轉換方法
以上步驟全部在這個頁面內完成,CSV 行列互換 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。