How to rename files from an Excel list.
Old name in, new name out.
Put the current file names in column A and the new names in column B. Then either let a script rename the files in place (PowerShell on Windows, Terminal on a Mac), or paste the two columns into a browser tool that shows every old and new name, blocks duplicates and invalid names, and gives you renamed copies in a ZIP. Whatever you use, check the list first: most failed renames come from a typo, a hidden extension or two rows with the same new name.
First, build a clean list
- Get the exact current names. Typing them invites typos. On Windows, select the files, hold Shift, right-click and choose Copy as path, paste into Excel and remove the folder part. On a Mac, select the files in Finder, copy (Cmd + C) and paste into a plain-text editor: you get the names.
- Decide about extensions. Windows hides them by default, so scan17 may really be scan17.pdf. Either include the extension in both columns or leave it out of both and let the tool add it.
- Keep IDs as text. If names contain student or employee numbers such as 000123, format the column as Text before pasting, or Excel turns them into 123. See why Excel removes leading zeros.
- Check for duplicates. Two rows with the same new name will fail or overwrite. In Excel, select column B and use Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
- Avoid characters Windows rejects:
\ / : * ? " < > |. A date written 2026/10/13 has to become 2026-10-13.
Four ways to rename from the list
1. PowerShell (Windows, renames in place)
Give the two columns the headers Old and New and save the sheet as CSV UTF-8 into the folder with the files, as rename.csv. In File Explorer, open that folder, type powershell in the address bar and press Enter, then run:
Import-Csv .\rename.csv -Encoding UTF8 | ForEach-Object { Rename-Item -LiteralPath $_.Old -NewName $_.New }Each row renames one file. Errors are printed for rows whose file is missing or whose new name already exists. There is no undo, so try it on a copy of the folder first.
2. A cmd batch file built with a formula (Windows)
In column C, enter ="ren """&A2&""" """&B2&"""" and fill it down. Copy column C into Notepad, save it as rename.bat in the folder with the files and double-click it. This works well for plain English names; names with Chinese, accented or other non-Latin characters can break in cmd, so use PowerShell for those.
3. Terminal (Mac)
Save the two columns, without a header, as rename.csv in the folder. In Terminal, type cd and a space, drag the folder into the window, press Enter, then run:
while IFS=, read -r old new; do new="${new%$'\r'}"; mv -n -- "$old" "$new"; done < rename.csv-n refuses to overwrite an existing file. This simple loop cannot handle names that contain commas.
4. A browser tool that checks first (any computer)
Batch Rename takes the files and the two columns pasted from Excel (or the .xlsx itself), matches each file to its row and shows old and new names side by side. It marks files with no row, rows with no file, duplicate names and characters Windows rejects before anything downloads, then gives you renamed copies in a ZIP with a rename list. Nothing is installed or uploaded, and the originals are not touched, which also makes it the safest way to try a list before renaming in place.
Which method fits
| Method | Renames in place | Checks the list first | Best for |
|---|---|---|---|
| PowerShell | Yes | No, errors appear as it runs | Large folders on Windows |
| cmd batch file | Yes | No | Short lists of English names |
| Mac Terminal | Yes | No | Mac users comfortable with Terminal |
| Batch Rename (browser) | No, makes renamed copies | Yes, every row | Locked-down PCs, delivering files with a list, checking a list |
Questions
Can Windows rename from a list without a script?
No. File Explorer and PowerToys PowerRename rename by pattern (find and replace, numbering), not by a list of individual new names. For a list you need a script or a tool that reads one.
How do I undo a list rename?
Swap the two columns and run the same method again: the new names become the old ones. Batch Rename does this for you when you load the rename-list.csv it put in the ZIP.
What if only some files are in the list?
Scripts skip rows they cannot match and leave other files alone. In Batch Rename you choose whether unlisted files are flagged, kept with their original names or left out of the ZIP.
Last updated