CSV Column Renamer
Rename multiple CSV headers with a mapping list
Enter one mapping per line, for example Old Name:New Name.
CSV Column Renamer — what it does
Rename any number of CSV headers in one pass by supplying a mapping list, one old-name-to-new-name pair per line. Only the header row changes; every data row is written back untouched, which makes this the safe way to make an export match a schema that expects exact field names.
Worked example
A staff export renamed to match an HR system's field names. When the file loads, the mapping box is pre-filled with one name:name line per header; three lines were edited and the salary line shortened to show that a line without a colon is harmless.
Input — rename mapping (contacts.csv headers: name, email, department, start_date, salary)
name:full_name email:email_address department:department start_date:hired_on salary
Output — contacts-renamed.csv
full_name,email_address,department,hired_on,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
The download takes the source name plus -renamed and starts with a UTF-8 byte-order mark. Data rows are copied through unchanged.
When this tool helps
- Matching an export to an import template that requires precise header spelling, such as Email rather than email_address.
- Translating headers into another language before handing a file to a team that works in it.
- Replacing cryptic system field names like fld_003 with labels a colleague can actually read.
How to use it
- Choose the CSV file.
- Enter one mapping per line as Old Name:New Name.
- Process the file.
- Download the CSV with the renamed headers.
Accuracy, limits, and good practice
- Old names must match the header exactly, including case and any trailing spaces — an unmatched entry silently changes nothing.
- Avoid renaming two different columns to the same label; downstream parsers will pick one arbitrarily and the other becomes unreachable.
- Headers with spaces are legal in CSV but awkward in code. Underscores travel better through scripts and databases.
Frequently asked questions
What if a header contains a colon?
The first colon on the line separates old from new, so a colon inside the old name will split incorrectly. Rename that column in a spreadsheet instead.
Does column order change?
No. Renaming is purely a label operation. Use the column reorder tool if you also need a different field sequence.
Can I rename only some columns?
Yes. Columns without a mapping entry keep their original names and appear unchanged in the output.
Can I clear a header by writing name: with nothing after the colon?
No. An empty new name is ignored and the original header is kept, so this tool cannot produce a nameless column.
What if the same old name appears on two lines?
The last line wins. With name:full_name followed by name:person, the header becomes person. Lines that name a header which does not exist in the file are ignored.
Related tools on this site
- JSON Difference Viewer — Compare two JSON documents and list added, removed, and changed values
- CSV Column Merger — Combine selected CSV columns into a new field
- CSV Join by Key — Combine two CSV files using a matching column
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 Column Renamer needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
CSV 欄位批量改名能做什麼
提供一份對照清單、每行一組「舊名稱:新名稱」,即可一次改掉任意數量的 CSV 標題。只有標題列會變動,所有資料列原樣寫回,因此這是讓匯出檔符合特定欄位名稱規格最安全的做法。
實際範例
把員工名單的欄名改成人資系統要的名稱。檔案載進後對照表會自動填好每個欄名一列的 name:name;這裡改了三列,salary 那列只留舊名,示範沒有冒號的列不會造成影響。
來源:改名對照表(contacts.csv 的欄名為 name、email、department、start_date、salary)
name:full_name email:email_address department:department start_date:hired_on salary
得到:contacts-renamed.csv
full_name,email_address,department,hired_on,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
下載檔以來源檔名加 -renamed 命名,開頭帶 UTF-8 BOM;資料列原樣複製。
什麼時候用得上
- 配合要求精確標題拼寫的匯入範本,例如必須是 Email 而非 email_address。
- 在把檔案交給使用其他語言的團隊前,先把標題翻譯過來。
- 把 fld_003 這種難懂的系統欄位名,換成同事看得懂的標籤。
使用步驟
- 選擇 CSV 檔案。
- 每行輸入一組「舊名稱:新名稱」。
- 執行處理。
- 下載標題已更名的 CSV。
精確度、限制與實務建議
- 舊名稱必須與標題完全一致,含大小寫與尾端空白;對不上的項目不會有任何提示,也不會生效。
- 避免把兩個不同欄位改成同一個名稱,下游解析器只會任選其一,另一欄就再也取不到。
- 含空格的標題在 CSV 中合法,但在程式裡難處理,改用底線在腳本與資料庫中更通用。
常見問題
如果標題裡本來就有冒號怎麼辦?
每行以第一個冒號分隔新舊名稱,因此舊名稱內含冒號會被切錯,這種欄位建議改在試算表中處理。
欄位順序會變嗎?
不會。改名純粹是標籤操作,需要調整欄位順序請用欄位重新排序工具。
可以只改部分欄位嗎?
可以。沒有列在對照清單中的欄位會保留原名,輸出時完全不變。
寫成 name: 而冒號後面留空,能把欄名清掉嗎?
不能。新名稱為空時會被忽略並保留原欄名,所以這個工具做不到沒有名字的欄位。
同一個舊名稱寫了兩列會怎樣?
以最後一列為準:先寫 name:full_name 再寫 name:person,欄名會變成 person。對照表裡提到檔案中不存在的欄名時,該列會被忽略。
本站相關工具
- JSON 差異檢視器 — 比較兩份 JSON 並列出新增、移除與修改內容
- CSV 欄位合併 — 將選定 CSV 欄位合併成新欄位
- CSV 欄位關聯合併 — 使用相符欄位合併兩個 CSV 檔案
延伸閱讀: 匯入之前先把 CSV 匯出檔清乾淨 · CSV、JSON、YAML、XML 與 Markdown 表格:各自適用的場合與轉換方法
以上步驟全部在這個頁面內完成,CSV 欄位批量改名 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。