How-to & Workflow

How to Rename PDF Files in Bulk From an Excel List

Here's the situation this page is about: you already know the correct names. They're sitting in a spreadsheet, maybe from a system export, a document index, or your system of record, and you have a folder of PDFs whose current filenames are wrong or meaningless. You don't need a tool to guess the names, and you don't need a uniform pattern that numbers everything the same way. You need to take the exact names you already have and apply each one to the right file. That's a mapping rename, and a spreadsheet is the natural place to build it. This guide shows you how to lay out the old-to-new mapping in Excel, export it to CSV, and execute it across the whole folder at once.

The Mapping Rename: When You Already Know the Names

Most bulk-rename advice assumes one of two things. Either you want a uniform pattern (Invoice001.pdf through Invoice300.pdf, a single rule applied to every file), or you want a tool to read each document and figure out a name for you. The spreadsheet method is neither. It exists for the case where you already hold the correct names and just need to attach them to the right files.

This comes up more than you'd think. An accounting system exports a list of invoice numbers, but the scanned PDFs are named scan_0001.pdf through scan_0300.pdf. A case-management system knows every matter's proper name, but the documents on disk carry whatever the scanner assigned. A migration hands you a lookup table mapping old document IDs to new ones. In every one of these, the truth about what each file should be called lives in a spreadsheet or an export, not inside the PDF and not in some pattern.

So the job is mechanical, not clever. You need a two-column list, current filename in one column and target filename in the other, one row per file, and then a way to run through that list and rename each file accordingly. The spreadsheet is the source of truth. The rest is execution.

The key discipline is precision. A mapping rename does exactly what your sheet says, so a typo in the sheet becomes a wrongly named file, and a mismatch between the sheet and the folder becomes a skipped or failed row. The steps below are built around getting the sheet right first, then applying it safely with a preview before anything actually changes on disk.

Build the Mapping Sheet

Open Excel (or Google Sheets, or any spreadsheet) and make exactly two columns. Column A is the current filename, including the extension, exactly as it appears on disk right now. Column B is the target filename you want, also including the extension. One row per file. That's the whole structure.

The single biggest time-saver is not typing column A by hand. Get the current filenames directly from the folder so they match byte for byte. On Windows, open a command prompt in the folder and run dir /b > filelist.txt to dump a bare listing of every filename into a text file, or in PowerShell run Get-ChildItem -Name > filelist.txt for the same result. Open that text file, copy the names, and paste them straight into column A. Now column A is guaranteed to match reality, because it came from reality.

With column A populated, fill in column B with the names you want. This is where your export, index, or system of record comes in: if the correct names are already in another sheet, line them up and paste them across, or use a lookup formula to pull the right target next to each current name. Then sanity-check a few rows by eye to make sure the right target landed next to the right source.

A few rules keep the rename from failing later. Keep the extension on both columns; a target of Acme_Invoice_2025-03-14 with no .pdf will produce a file the operating system no longer treats as a PDF. Avoid duplicate values in column B, because two files cannot share one name in the same folder and the second rename will be refused. And strip illegal filename characters out of the target column: on Windows a name cannot contain any of these characters, backslash, forward slash, colon, asterisk, question mark, double quote, less-than, greater-than, or pipe. Slashes in a date or a colon in a time are the usual culprits, so replace them with hyphens or underscores before you export.

Export to CSV

A script or rename tool can't read a native .xlsx file directly, so save the sheet as CSV, which is plain text any tool can parse. In Excel, choose File, then Save As, and pick CSV (Comma delimited) as the format. Save it somewhere easy to reach, ideally in or next to the folder of PDFs.

Give the two columns a header row so the tools that read it know which column is which. Put OldName in the first cell and NewName in the second, on the very first row, above your data. So the file reads OldName,NewName on line one, then one row per file after that, current name comma target name. That header is what lets Import-Csv address the columns by name in the next step.

Quickly open the saved CSV in a plain text editor to confirm it looks right: a header line, then one line per file with exactly one comma separating old from new. If any of your names legitimately contain a comma, Excel will have wrapped that field in double quotes automatically, which is correct and expected. Leave those quotes alone.

Apply It With PowerShell (Import-Csv)

PowerShell reads a CSV natively and can drive the rename with a couple of lines. The Import-Csv command turns each row into an object with an OldName property and a NewName property (named after your header row), and you pipe those objects into a loop that renames one file per row.

The shape looks like this. First preview, changing nothing: Import-Csv .\mapping.csv | ForEach-Object { Rename-Item -Path $_.OldName -NewName $_.NewName -WhatIf }. The -WhatIf flag is the safety net. Instead of renaming anything, PowerShell prints what it would do, one line per file, so you can read down the list and confirm every old name is being matched to the right new name. Run this first, every time.

When the preview looks correct, run the exact same line with -WhatIf removed: Import-Csv .\mapping.csv | ForEach-Object { Rename-Item -Path $_.OldName -NewName $_.NewName }. Now it renames for real, one file per row, in order. Run it from inside the folder that holds the PDFs (or put the full path in the OldName column) so PowerShell can find each file. That's the whole execution: one line to preview, the same line to commit.

If you'd rather keep a record, you can log what happened by appending a redirect, but the -WhatIf preview is the step that actually prevents mistakes. Reading that preview is not optional, it is the difference between catching a misaligned column now and discovering it across 300 files later.

Or Use a Tool That Imports a List

If you'd rather not touch a command line, several dedicated bulk-rename utilities can import a CSV or Excel file and use it to drive the renames, no scripting involved. You point the tool at your mapping file, tell it which column is the current name and which is the target, and it applies the list, usually with a preview grid so you can eyeball the pairing before committing.

The mechanics differ from tool to tool, but the concept is identical to the PowerShell approach and to everything above: your spreadsheet is the source of truth, and the tool is just the thing that walks the list and performs each rename. Whether the executor is a two-line script or a point-and-click utility, the work that matters, and the work that has to be correct, is the mapping sheet you built. Get column A and column B right, and any executor will do the same job.

Handling the Things That Go Wrong

A mapping rename fails in predictable ways, and each failure points straight at the cell that caused it. Knowing the three common ones turns a scary red error into a two-second fix.

A row whose OldName no longer matches a file on disk. If column A says scan_0007.pdf but that file was already renamed, moved, or was never there, Rename-Item reports that it can't find the path and moves on. The rename doesn't happen for that row, and the rest of the list continues. The fix is to correct that one cell so it matches the actual filename, then re-run. This is exactly why you pull column A from a live directory listing rather than typing it: the listing can't misspell a name that exists.

A target name that already exists. If two rows in column B resolve to the same name, or a target matches a file already in the folder, the operating system refuses the second rename rather than silently overwriting a file. That's protective, not a bug. De-duplicate column B (sort it and scan for repeats, or use a duplicate-highlight rule in Excel) so every target is unique, then re-run the ones that were refused.

The row count not matching the file count. If your sheet has 300 rows but the folder has 305 PDFs, or vice versa, something drifted between when you captured the listing and when you ran the rename, a file got added, removed, or renamed in between. Regenerate the directory listing, line it back up against column A, and reconcile the difference before you apply. A mapping that doesn't cover the folder one-to-one is a sign the source of truth went stale, and it's worth fixing at the sheet level rather than pushing through.

Spreadsheet Rename vs Pattern vs Content

ApproachWhere the new name comes fromBest when
Pattern renameA rule applied to all files (a counter, prefix, or find-and-replace) that produces uniform, numbered namesEvery file should get the same kind of name and you don't care what each one contains
Spreadsheet / Excel mappingA list you built yourself, one exact target per file; you already know each nameYou already hold the correct names in an export, index, or system of record and just need to apply them
Content-basedThe tool reads the file; the name lives inside a scan or PDF and you don't have it yetYou're looking at a folder of documents and don't yet know what each one should be called

When a Spreadsheet Isn't the Right Tool

It's worth being honest about the limit of this method, because it's a sharp one. The Excel mapping approach is close to perfect when you already hold the correct names. The names exist somewhere, in an export, an index, a system of record, and the only work left is attaching them to the right files. In that situation nothing beats a spreadsheet: it's precise, auditable, and you can review every single target before a byte changes on disk.

But notice the assumption baked into every step above: that you can fill column B. That only works if you already know what each file should be called. Flip the situation around, imagine you're staring at a folder of 300 scans and you genuinely don't know what each one is, and the method quietly falls apart. To build the mapping sheet you'd have to open all 300 files, read each one, and type its name into column B by hand. That's not a shortcut, that's the entire problem you were trying to solve, just moved into a spreadsheet.

This is exactly where content-based renaming earns its place. A tool that reads the file itself, using OCR to pull the vendor, the date, and the document type off a scanned page, can generate the names you don't yet have, which is the one thing a spreadsheet can never do for you. Renamer.ai sits in that category: it reads each document and proposes a descriptive name, with a preview step so you confirm before anything is renamed. If your problem is applying names you already have, stay with the spreadsheet method on this page. If your problem is that you don't have the names yet, the scanned-PDF workflow hub covers the content-based side in detail.

Putting It Together

The spreadsheet method is the right answer to a specific, common problem: you already know the correct names and just need to apply them to a folder of PDFs at scale. Build the two-column sheet, pull column A from a live directory listing so it matches disk exactly, fill column B from your export or system of record, keep the extensions, keep every target unique and legal, and export to CSV with an OldName,NewName header. Then let PowerShell's Import-Csv drive Rename-Item, previewing with -WhatIf every time before you commit, or hand the same CSV to a rename utility that imports lists. Either way, the sheet is the source of truth and the executor is interchangeable.

And know where the method stops. The moment you can't fill column B without opening every file, you've left mapping territory and entered content-based territory, where a tool that reads the document does the work the spreadsheet can't. For that side of the problem, and the wider scanned-document workflow, the hub on how to rename scanned PDF files picks up the thread.

Frequently Asked Questions

How do I rename PDF files from an Excel list?

Build a two-column sheet with the current filename (including .pdf) in one column and the exact target name in the other, one row per file. Save it as a CSV with a header row of OldName,NewName. Then run it through PowerShell with Import-Csv .\mapping.csv | ForEach-Object { Rename-Item -Path $_.OldName -NewName $_.NewName }, or feed the CSV to a bulk-rename tool that imports lists. Always preview first (add -WhatIf in PowerShell) so you can confirm every pairing before anything actually renames.

How do I get the current filenames into a spreadsheet?

Don't type them by hand, dump them from the folder so they match exactly. On Windows, open the folder in a command prompt and run dir /b > filelist.txt for a bare listing, or in PowerShell run Get-ChildItem -Name > filelist.txt. Open that text file, copy the names, and paste them into your first column. Because the list came straight from disk, the current names are guaranteed to match reality, which is what keeps the rename from failing on a mistyped source name.

What happens if a filename in my list doesn't match?

If a row's OldName doesn't match a real file on disk, the rename for that row is reported as a path-not-found error and skipped, while the rest of the list keeps going. Nothing gets renamed incorrectly, that one row just doesn't run. The fix is to correct that cell so it matches the actual filename, then re-run. This is why pulling the source column from a live directory listing matters: a listing can't misspell a name that exists. Separately, if a target name is already taken, the operating system refuses that rename rather than overwriting, so de-duplicate your target column.

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

Use the spreadsheet method when you already know the correct names, they live in an export, an index, or a system of record, and you just need to apply them. Switch to content-based renaming when you don't have the names yet and would have to open every file to write them down. If building your mapping sheet means reading 300 scans by hand, a tool that reads the files for you (using OCR to pull the name off each page) does the work the spreadsheet can't. Renamer.ai handles that content-based case, reading each document and proposing a name with a preview before it renames.