Back to Glossary
File Management

Rename Files From a Spreadsheet

Renaming files from a spreadsheet is a batch renaming method where a table, usually in Excel or a CSV file, lists each file's current name next to the name it should have. A script or renaming tool reads the rows and renames each matching file. The method is useful when the new names come from outside data such as product codes, employee IDs, or invoice numbers that already exist in a spreadsheet.

Do it automatically

Let Sortio handle this pass

Rather than doing this by hand, describe the result you want and let Sortio propose the moves. You review the plan before anything is applied, and every sort can be undone.

Works on Mac and Windows
Review the plan before anything moves
Last updated: 10/1/2026
File Management

What Rename Files From a Spreadsheet means

Renaming files from a spreadsheet means using a table as the source of truth for new filenames. The usual layout has two columns: column A holds the current filename (for example, IMG_4021.jpg) and column B holds the target name (for example, SKU-88213-front.jpg). Each row maps one file to one new name. People often search for how to rename files from an Excel list when the naming information already lives in a spreadsheet, such as a product catalog, a class roster, a property listing export, or a list of scanned documents and their case numbers.

The approach is common because no pattern can produce these names. A find-and-replace rule or a numbering sequence can't know that IMG_4021 shows product 88213. Someone has to supply that mapping, and a spreadsheet is the most familiar place to build, review, and share it.

For file organization, spreadsheet-driven renaming turns a list you already maintain into consistent, searchable filenames. That makes files easier to find, sort, and match to records in other systems like e-commerce platforms, digital asset managers, or document archives.

Rename Files From a Spreadsheet in practice

The process starts with building the mapping. You list the existing filenames in one column, often by exporting a folder listing (dir /b on Windows or ls in a macOS or Linux terminal) and pasting it into Excel. Then you fill in the new names next to them, usually with formulas that combine other columns, such as =C2&"-"&D2&".jpg". When the sheet is ready, you save it as a CSV so scripts can read it reliably.

Next, a script or tool walks through the rows and renames the files. On Windows, PowerShell can do this in one line: Import-Csv names.csv | ForEach-Object { Rename-Item -Path $_.Old -NewName $_.New }, where Old and New are the column headers. On macOS and Linux, a shell loop that reads each line and calls mv -n does the same job, and the -n flag keeps it from overwriting existing files. Some people skip scripting and use an Excel formula to generate a full rename command for each row, then paste the commands into a terminal. Dedicated batch renaming utilities can also import a list of names.

Sortio handles a related but different case. Instead of reading a spreadsheet mapping, Sortio's optional renaming feature generates new names from a natural language prompt, using filenames and metadata, or file content if you turn on the content sorting toggle. Content analysis only occurs when you explicitly enable the content sorting toggle. If your naming logic can be described as a rule, such as "date, client name, document type," a prompt-based approach can replace building the spreadsheet in the first place.

Where it goes wrong (and how to fix it)

Challenge:

Excel quietly changes data: it drops zero-padding from numeric IDs, converts values like 3-12 into dates, and can save CSVs in an encoding that breaks accented characters.

Solution:

Set the columns to Text format before pasting data, check a few rows in a plain text editor after export, and save as CSV UTF-8 when filenames include non-English characters.

Challenge:

Filenames in the sheet don't match the files on disk exactly because of trailing spaces, different capitalization, or missing extensions, so some rows are skipped or fail.

Solution:

Generate the old-name column from an actual folder listing instead of typing it, use TRIM() to clean whitespace, and have your script log any row whose source file isn't found.

Challenge:

Two rows map to the same new name, or a new name matches a file that already exists, which can overwrite data.

Solution:

Flag duplicates in the spreadsheet before running, and use options that refuse to overwrite, such as mv -n on macOS and Linux or a Test-Path check in PowerShell.

Challenge:

Building and maintaining the mapping takes a lot of manual work when the naming logic is actually a consistent rule.

Solution:

If names can be derived from dates, metadata, or document contents, consider a prompt-based renamer that applies the rule for you. AI-powered sorting learns from your preferences; results may vary by file type and complexity.

Benefits of Rename Files From a Spreadsheet

Applies names that come from outside data, like SKUs, case numbers, or student IDs, that no pattern-based renamer can infer
Lets you review and correct every new name in a familiar spreadsheet view before any file changes
Makes it easy to share the plan with a colleague or client for approval before renaming
Handles hundreds of files in one pass instead of renaming them one by one
Creates a lasting record of old-to-new names that you can keep for auditing or reversing the change
Keeps filenames consistent with records in other systems, which makes matching and importing more reliable
Pairs well with Sortio when part of your library follows a describable naming rule, since Sortio can rename those files from a prompt and back them up before making changes

Getting Rename Files From a Spreadsheet right

1
Copy the target folder or run a test on a small sample before renaming the full set
2
Include the file extension in both columns, or have your script add it, so files don't lose their type
3
Format the filename columns as Text in Excel so IDs with zero-padding like 00123 aren't stripped or turned into dates
4
Check for duplicate values in the new-name column with conditional formatting or COUNTIF before running anything
5
Remove characters your operating system doesn't allow in filenames, such as / : * ? " < > | on Windows
6
Save a reverse mapping (new name to old name) so you can undo the batch if needed, or use a tool like Sortio that backs up files and lets you revert changes

Putting this into practice with Sortio

You do not need to master rename files from a spreadsheet by hand. Sortio reads file names, metadata, and (when you enable the content toggle) document contents, then proposes an organization plan you approve before any file moves. One-click undo covers the rest.

Get Sortio for Mac or Windows

Frequently Asked Questions

How do I rename files from an Excel list on Windows?

Put current filenames in one column and new names in another, add the headers Old and New, and save the sheet as CSV. In PowerShell, open the folder and run: Import-Csv names.csv | ForEach-Object { Rename-Item -Path $_.Old -NewName $_.New }. Test it on a copy of the folder first.

Can I rename files from a spreadsheet on a Mac or Linux?

Yes. Export the sheet as a CSV, then use a Terminal loop that reads each line and runs mv -n with the old and new names. The -n flag keeps existing files from being overwritten. Make sure the CSV uses Unix line endings and has no stray quotes or spaces around the names.

Can Sortio rename files from a spreadsheet?

Sortio doesn't import spreadsheet mappings. Its optional renaming feature creates names from a natural language prompt, such as "rename invoices as date, vendor, amount," using filenames and metadata, or file content when you enable content sorting. Sortio backs up files before changes so you can revert them. It runs on macOS, Windows, and Linux.

How do I undo a spreadsheet-based rename?

Keep the original CSV and make a reversed copy with the columns swapped, so the new names become the source and the old names become the target. Running the same script with the reversed file restores the original names. Do this before moving or editing the renamed files.

Why did some files not get renamed?

The usual cause is a mismatch between the spreadsheet and the actual filenames: a missing extension, extra spaces, different capitalization on case-sensitive systems, or characters Excel changed during export. Rebuild the old-name column from a real folder listing and have your script log rows it couldn't match.

Related Terms