Bulk & Automation

Rename Files From an Excel or CSV List

When you already know exactly what each file should be called, an old-name-to-new-name list, a spreadsheet is the fastest way to apply it. You put the current filenames in one column and the new names in the next, and a short script or tool renames each file to its match. This is the mapping method: distinct from pattern renaming (one rule for all files) and from content-based renaming (the tool reads the file). It's the right approach whenever the correct names live in a list you can build, not in a rule and not inside the files.

Is a Mapping List the Right Method?

A list-driven rename fits one specific situation. Here's how it compares to the alternatives.

Where the new names come fromMethodThis page?
A list you already have (old → new)Excel / CSV mappingYes
One rule for every file (date, prefix, number)Pattern rename (PowerShell, PowerRename)No, different method
Inside each file (invoice no., parties)Content-aware renamingNo, different method
Just a few files, names in your headManual F2Overkill to list them

Step 1: Build the Mapping in Excel

Start with two columns. In column A, the current filename exactly as it is on disk, including the extension (Scan0043.pdf). In column B, the new name you want (2024-Acme-Invoice.pdf). One row per file. If your files follow some order you already track, a product list, a client roster, you can often generate column B with a formula (a CONCAT of a date, a name, and a counter) rather than typing every name by hand.

Accuracy in column A is the thing that trips people up: the old name has to match the file on disk character for character, or the rename skips it. Copying the real filenames into the sheet, rather than retyping them, avoids that. Once both columns are right, save the sheet as a CSV (File, Save As, CSV) so a script can read it cleanly.

Step 2: Apply the List With PowerShell

PowerShell reads a CSV and renames each file to its mapped name in a few lines. With a mapping.csv that has headers OldName and NewName:

Two things are worth watching on the first real run. A row whose OldName no longer matches anything on disk produces an error and is skipped, which is what keeps a typo from renaming the wrong file. A row whose NewName already exists in the folder is refused rather than overwritten, so nothing is silently lost to a collision. Because each error names the exact row that failed, you can correct just those cells in the sheet and re-run only the failures, and the list stays your single source of truth for the whole folder.

  1. Put mapping.csv in the same folder as the files.
  2. Import and preview: Import-Csv mapping.csv | ForEach-Object { Rename-Item -Path $_.OldName -NewName $_.NewName -WhatIf }
  3. Read the -WhatIf output to confirm each old name matched a real file and the new names look right.
  4. Remove -WhatIf and run it again to apply every rename from the list.
  5. Any row whose OldName doesn't match a file is reported as an error rather than renaming the wrong file, so check for skips.

Step 3 (Alternative): Apply It Without Scripting

If you'd rather not run a script, a couple of routes work. Some dedicated bulk-rename utilities can import a rename list directly, matching each row to a file. Or you can have Excel itself generate a batch of ren commands: in a helper column, build a formula like ="ren """&A2&""" """&B2&"""", copy the resulting lines into a .bat file, and run it in the folder. It's less elegant than importing a CSV, but it needs nothing beyond Excel and the command prompt. Whichever route you take, work on a copy of the folder the first time so a mismatched row can't do damage.

When a Formula Beats Typing the List

The mapping method shines when column B can be computed. If your files should be named from data you already keep in a spreadsheet, an order number, a client, a date, a formula fills the new-name column for hundreds of files at once, and the rename applies them all. That turns what looks like a tedious manual job into a two-minute one. The limit is that the data has to already exist in your sheet; if it doesn't, you're back to either typing each name or reading the files, which the next section covers.

When the Right Names Aren't in a List Yet

The mapping method has one prerequisite: you already know the new names. Often the reason you're renaming a folder is that you don't, the files are scans named Scan0043.pdf, and the only way to know each one's correct name is to open it and read what's inside. There's no list to import, because building the list would mean opening every file, which is the work you were trying to avoid.

That's exactly where content-aware renaming replaces the spreadsheet. Instead of you mapping old names to new ones, OCR and AI read each file, extract the identifying details, and generate the new name directly, effectively building the mapping for you from the documents themselves. It's the tool for when the correct names live inside the files rather than in data you already hold. For that approach, see the bulk rename software overview.

So the clean division is: if you can produce the list of new names from data you already have, the Excel-mapping method here is fast and free; if you'd have to read each file to know its name, let a content-aware tool read them for you.

Frequently Asked Questions

How do I rename files from an Excel list of names?

Put each current filename in one column and its new name in the next, save the sheet as CSV, then apply it with PowerShell: Import-Csv mapping.csv | ForEach-Object { Rename-Item $_.OldName -NewName $_.NewName }. Preview with -WhatIf first.

Do the old filenames have to match exactly?

Yes. The old name in your list must match the file on disk character for character, including the extension, or that row is skipped. Copy the real filenames into the sheet rather than retyping them to avoid mismatches.

Can I do this without PowerShell?

Yes. Some bulk-rename utilities import a rename list directly, or you can have Excel build a column of ren commands and paste them into a .bat file to run. Work on a copy of the folder the first time either way.

Can I generate the new names automatically?

If the data you want in the names already lives in your spreadsheet (dates, client names, order numbers), a formula can build the new-name column for hundreds of files at once. If the data isn't there, you'd need to read the files instead.

What happens if a listed file is missing?

Rename-Item raises an error for that row and moves straight on, so every other row in the list still applies and nothing gets renamed to the wrong target. Scan the run for the reported failures, fix those OldName cells in the sheet, then re-run just the rows that skipped. Previewing with -WhatIf first surfaces every missing file before you commit a single change.

What if a target name already exists in the folder?

Rename-Item refuses to overwrite an existing file and reports the clash as an error instead of clobbering it. Usually this means two rows point column B at the same new name, or the file was already renamed on an earlier pass. De-duplicate column B in Excel before you apply the list, and preview with -WhatIf so any collision shows up while nothing has changed yet.

What if I don't have the new names, only the files?

Then there's no list to import, because the names are inside the files. Content-aware renaming reads each file with OCR and AI and generates the name directly, effectively building the mapping from the documents themselves.