Bulk & Automation

How to Batch Rename Files From a Spreadsheet

Sometimes you already know exactly what every file should be called. The new names live in a spreadsheet a colleague sent you, or they come out of another system as a CSV, or you have a folder of scans and a list of what each one really is. When the mapping already exists, you do not need clever pattern rules or regex. You need a way to say "this file becomes that name" for every row, and then apply the whole list at once. That is what renaming from a spreadsheet does: you build an explicit old-name to new-name map in Excel, Google Sheets, or a plain CSV, and then a small script or a GUI tool walks the list and renames each file to match. This guide shows you how to build that mapping sheet correctly, three ways to apply it (PowerShell, an Excel-generated batch file, and a GUI tool's CSV import), and how to handle the errors that always crop up when a row and a file disagree. It also covers the one case where a spreadsheet is the wrong tool, and typing 500 names by hand is a sign you should let something read the files for you instead.

Build the Mapping Sheet: Two Columns, One Row Per File

Every spreadsheet rename comes down to the same simple structure: two columns and one row per file. Column A holds the current filename exactly as it exists on disk, including the extension. Column B holds the target filename you want, also including the extension. Put a header on each so the columns are easy to reference later, something like OldName in A1 and NewName in B1, then one row per file underneath. That is the entire data model. Everything else in this guide is just a way to apply that sheet to the folder.

The part people get wrong is the current-names column. Do not retype the existing filenames, because a single typo means that row will not match any file and will silently do nothing. Instead, generate the list of names from the folder itself and paste it in. On Windows, open the folder in a command prompt and run dir /b > list.txt, which writes a bare listing of every filename into a text file. If you prefer PowerShell, Get-ChildItem | Select-Object -ExpandProperty Name gives you the same clean list. On a Mac or Linux box, ls > list.txt in the folder does it. Open the resulting text file, copy the names, and paste them straight into column A. Now column A matches disk exactly, character for character, because the computer wrote it, not you.

With column A populated, fill in column B with the names you want. A few rules keep the whole operation safe. Always keep the extension on both sides, because a rename that drops .pdf turns a document into a file Windows no longer knows how to open. Avoid characters that are illegal in filenames, which on Windows means the colon, slash, backslash, question mark, asterisk, quote, and the angle brackets. And make sure no two rows in column B produce the same target name, because two files cannot share a name in one folder, and the second rename will be refused. When column A is clean and column B is unique and legal, the sheet is ready to export and apply.

A Concrete Before and After

It helps to see one row in full. Suppose you have a folder of scanned invoices with meaningless scanner names, and you know from a log or an index what each one actually is. Your sheet has a row that reads scan_001.pdf in the OldName column and 2026-02_Acme_Invoice_4471.pdf in the NewName column. When you apply the list, the file that was sitting on disk as scan_001.pdf becomes 2026-02_Acme_Invoice_4471.pdf, and it lands in the exact spot alphabetical and chronological sorting expects. Repeat that for every row, and a folder that used to sort as scan_001, scan_002, scan_003 becomes a folder that sorts by date and vendor, which is the whole point. The mapping sheet is the source of truth, and the apply step just makes disk agree with it.

Apply With PowerShell: Import-Csv Piped to Rename-Item

Once the sheet is built, export it as a CSV. In Excel or Google Sheets, use Save As or Download and pick CSV, naming it something like map.csv and saving it into the same folder as the files. The CSV is just your two columns with the OldName and NewName headers on the first line.

PowerShell reads that CSV natively and can drive the whole rename in one line. The safe way to run it is to preview first with -WhatIf, which tells PowerShell to report what it would do without touching a single file. From the folder, run Import-Csv map.csv | ForEach-Object { Rename-Item -LiteralPath $_.OldName -NewName $_.NewName -WhatIf }. PowerShell prints a line for each row describing the rename it would perform. Read that output. Every row should show a sensible old-to-new pairing, and you should see one line per file with no errors. The -LiteralPath switch matters here: it tells PowerShell to treat the name literally, so filenames that contain square brackets or other characters PowerShell would otherwise interpret still match correctly.

When the preview looks right, run the exact same command with the -WhatIf removed, so it becomes Import-Csv map.csv | ForEach-Object { Rename-Item -LiteralPath $_.OldName -NewName $_.NewName }. This time PowerShell actually performs each rename. Because it reads the mapping row by row, the order in the sheet does not matter, and you can rename hundreds or thousands of files in the time it takes the loop to run. This is the most reliable of the three methods, and if you have PowerShell available it is the one to reach for.

Excel-Generated Commands: Build a .bat With a Formula

If you would rather not touch PowerShell, Excel can write the rename commands for you and you paste them into a batch file. The old Windows command for renaming is ren, and it takes an old name and a new name in quotes. So in a spare column, write a formula that concatenates a ren command around your two columns. With OldName in column A and NewName in column B, put this in C2 and fill it down: ="ren """&A2&""" """&B2&"""". Each cell in column C now reads something like ren "scan_001.pdf" "2026-02_Acme_Invoice_4471.pdf", one complete command per file. The doubled quotes in the formula are how Excel produces the literal quote marks that protect names containing spaces.

Copy the whole C column, paste it into a plain text editor like Notepad, and save the file with a .bat extension, for example rename.bat, in the same folder as the files. Double-click it, or run it from a command prompt in that folder, and Windows executes each ren line in turn. Nothing gets installed, and the batch file is a permanent record of exactly what you renamed. The one caution is that ren gives you no preview, so read a few lines of the .bat before you run it, and keep a backup of the folder the first time until you trust your formula.

GUI Tools: Import the CSV Instead of Scripting

If scripts and batch files are not your thing, dedicated bulk-rename tools can take the same two-column list and drive the renames for you through a window with a preview. Bulk Rename Utility and Advanced Renamer both accept an imported list or CSV that maps current names to target names, so you point them at your folder, import the file, and they line each new name up against its file for you to confirm before anything changes.

The advantage of the GUI route is the visible preview and the undo safety net that most of these tools provide, which is reassuring on a large or important batch. The trade-off is that the import feature is a little buried in each tool and the exact CSV format it expects varies, so you may need to check the tool's help to see whether it wants a header row and which column it reads first. For a one-time job of a few hundred files where you would rather click than type a command, importing your sheet into one of these tools is a perfectly good option. They are covered in more depth on the bulk rename software hub.

Three ways to apply a spreadsheet rename

ApproachBest forInstall neededPreview before applySkill level
PowerShell Import-CsvAny size batch, repeatable jobs, serversNone (built into Windows)Yes, run with -WhatIf firstComfortable with a command line
Excel-generated .batQuick one-off jobs, no scripting appetiteNone (uses the classic ren command)No live preview, read the .bat firstBasic, if you can fill an Excel formula
GUI CSV import (Bulk Rename Utility, Advanced Renamer)Visual confirmation, undo safety, non-technical usersYes, install the toolYes, on-screen before-and-afterPoint and click

When a Row and a File Disagree: Handling Problems

Spreadsheet renames fail in predictable ways, and all of them come from the sheet and the folder drifting out of sync. The most common is a row whose OldName no longer matches any file on disk, usually because the file was already renamed, moved, or the cell has a stray space or a typo. PowerShell will report an error for that row and move on to the next one, and ren will print a message that the file cannot be found. Nothing is damaged; the row is simply skipped. The fix is to correct the cell so it matches the real filename exactly, which is far easier if you generated column A from a directory listing in the first place rather than typing it.

The second common failure is a NewName that already exists in the folder, either because two rows in column B are identical or because a file with that name was already there. The rename is refused, not silently overwritten, so you will not lose data, but the file keeps its old name and you get an error for that row. The fix is to de-duplicate column B: sort it, look for repeats, and make every target name unique before you run the list again.

The third thing to check before you run anything is that your row count matches your file count. If the folder has 500 files but the sheet has 480 rows, twenty files will be left untouched, and if the sheet has more rows than files, the extra rows will error as unmatched. A quick way to sanity-check is to compare the number of rows in column A against the file count Windows shows for the folder. When the counts line up and column A was generated from the folder, most of these problems disappear before they start.

The Hard Part Is Typing the New Names

Step back and notice where all the effort in this method actually goes. Building column A is free, because a directory listing writes it for you. Applying the list is fast, because a script or a tool walks it in seconds. The entire cost of a spreadsheet rename lives in column B, the target names, and specifically in how you produce them. If those names come out of another system, a database export, an index, a shipping manifest, then a spreadsheet is exactly the right tool and this whole guide is your answer.

But if you are filling column B by opening each file, reading what is inside it, and typing a descriptive name, stop. That is not a spreadsheet job. Hand-typing 500 target names by reading 500 documents is the slow, error-prone work the spreadsheet was supposed to save you from, and no amount of clever PowerShell fixes it, because the bottleneck is a human reading files, not the rename itself.

This is where content-based renaming belongs. Unlike rule-based renamers that only see filenames, renamer.ai reads the actual document content (OCR + AI vision) to generate descriptive names automatically. For a folder of invoices, contracts, or receipts, it opens each file, pulls out the vendor, the date, the document number, the amount, whatever your naming template calls for, and produces the new name for you. In other words, it builds column B by reading the files, which is the one column a spreadsheet cannot fill on its own. To be honest about the boundary: a spreadsheet mapping is the right tool when you already know each new name or it comes from another system, and renamer.ai is the right tool when the names live inside the files and the only way to get them is to read each document. If you find yourself about to type names by reading files, that is your signal to switch.

Scanned Files Have No Text to Copy Into the Sheet

There is a specific version of the typing problem that a spreadsheet cannot solve at all, and it is worth calling out. A scanned document, a photographed receipt, an image-only PDF from a copier, contains no selectable text. It is a picture of a page. So when you open it to figure out what to put in column B, there is nothing to copy: you have to read the image with your eyes and retype what you see, for every single file. That is the most tedious possible way to fill a mapping sheet, and it is exactly the case where spreadsheet renaming breaks down.

This is what OCR is for. Optical character recognition reads the text out of an image, so a scanned invoice becomes searchable, extractable content instead of a flat picture. Renamer.ai runs OCR (plus AI vision for layout and context) on scanned and image-only files, which means it can pull the vendor and date and invoice number out of a scan the same way it does from a native PDF, and generate the new name from that. If your folder is full of scans and you were dreading building the mapping sheet by hand, that dread is the tell: let OCR read the files and produce the names, then apply. The spreadsheet approach is still perfect for files whose new names you already have; it is only the reading-and-typing step that content-based renaming removes.

Choosing Your Path

Put the whole decision together and it is short. If you already have the target names, build the two-column sheet, generate column A from a directory listing so it matches disk exactly, export a CSV, and apply it with PowerShell using -WhatIf to preview or with an Excel-generated .bat, or import it into a GUI tool if you want a visual preview and undo. Watch for the three failure modes: unmatched OldName rows that skip, duplicate NewName targets that get refused, and a row count that does not match the folder. If instead you are about to fill column B by reading each file, especially if those files are scans, that is content-based renaming's job, and renamer.ai builds that list for you by reading what is inside the documents. Match the tool to where your new names actually come from, and the renaming itself is the easy part.

Frequently Asked Questions

How do I rename files from an Excel or CSV list?

Build a two-column sheet with the current filename (including its extension) in column A and the target filename in column B, one row per file. Export it as a CSV, then apply it with PowerShell (Import-Csv piped to Rename-Item), with an Excel-generated .bat file, or by importing the CSV into a GUI tool like Bulk Rename Utility or Advanced Renamer.

How do I get the current filenames into a spreadsheet?

Do not retype them, because a typo means the row will not match. Generate the list from the folder instead. On Windows run dir /b > list.txt in the folder, or in PowerShell run Get-ChildItem | Select-Object -ExpandProperty Name. On a Mac or Linux run ls > list.txt. Then copy the names from that list and paste them into column A, so the column matches disk exactly.

How do I apply a rename list with PowerShell?

Save the two-column sheet as a CSV, then from the folder run Import-Csv map.csv piped to ForEach-Object { Rename-Item -LiteralPath $_.OldName -NewName $_.NewName -WhatIf }. The -WhatIf switch previews the renames without changing anything. When the preview looks correct, run the same command with -WhatIf removed to perform the renames for real.

What happens if a filename in my list does not match a file?

That row is skipped, not forced. PowerShell reports an error for the unmatched OldName and moves on, and the ren command prints a file-not-found message, but nothing is damaged. Usually the cause is a typo or a stray space in the cell, or the file was already renamed or moved. Fix the cell to match the real filename and run the list again, which is easiest when column A was generated from a directory listing.

When should I use content-based renaming instead of a spreadsheet?

Use a spreadsheet when you already know each new name or it comes from another system. Use content-based renaming when the new names live inside the files and you would otherwise have to open and read each one to type them. Unlike rule-based renamers that only see filenames, renamer.ai reads the actual document content (OCR and AI vision) to generate descriptive names automatically, so it builds the target-name column for you instead of you typing it, which is especially useful for scanned or image-only files that have no selectable text.