Home/Guides/Rename from Google Sheets
How to rename files from a Google Sheets list
Last updated . Takes about 3 minutes for a batch of 100 files.
"Rename files from Google Sheets" can mean two different jobs, and they need different tools:
- The files are on your computer (or you can download them), and the sheet holds the old and new names. Download the sheet, then rename locally with a preview. Sections 1–4.
- The files live in Google Drive and must stay there with the same sharing links. That needs Apps Script. Section 5.
1. Lay out the sheet
Put Old name in A1 and New name in B1. Column A holds each filename exactly as it is
now; the extension is optional. To get current filenames into the sheet without typing, copy them from your
computer (see how to get a list of file names; the same
commands work for Sheets) and paste into A2, or use File → Import with a CSV.
2. Build the new names with formulas
Type a formula in B2 and drag it down (or double-click the small square at the cell's corner):
| Goal | Formula in B2 |
|---|---|
| Lowercase, hyphens instead of spaces and symbols | =REGEXREPLACE(LOWER(REGEXREPLACE(A2,"\.[^.]+$","")),"[^a-z0-9]+","-") |
| Sequential numbers | ="invoice-2026-"&TEXT(ROW()-1,"000") |
| Look up a name from another tab | =IFERROR(VLOOKUP(A2,Codes!A:B,2,FALSE),"") |
| Combine columns (client, date, title) | =C2&"_"&TEXT(D2,"yyyy-mm-dd")&"_"&E2 |
The first formula strips the extension, lowercases the rest and turns every run of other characters into a
single hyphen, so Q3 Report (final).PDF becomes q3-report-final-. Note the trailing
hyphen. Wrap it in another REGEXREPLACE(…,"-$","") if that bothers you.
Two quick checks before you download: Data → Data cleanup → Trim whitespace removes stray spaces
from pasted names, and =COUNTIF(B:B,B2)>1 as a conditional-format rule highlights duplicate new
names. Mass Rename also catches both, but fixing them in the sheet is quicker.
3. Download the sheet
Use File → Download and pick one of:
- Microsoft Excel (.xlsx): includes every tab. Mass Rename lists all of them and you choose one.
- Comma-separated values (.csv): only the tab you are looking at.
Either way, formulas are exported as their results, which is what the renamer reads. Mass Rename does not open a Google Sheets link directly; it needs the downloaded file.
4. Rename the files
- Open the renamer and drop the
.xlsxor.csvon the first box. - Confirm the old-name and new-name columns. Headers like
Old name/New nameare detected automatically. - Add the files: select them, or drop a ZIP.
- Check the preview. Conflicts (two files heading for the same name), illegal names and rows with no matching file are each listed with a reason.
- Download the renamed ZIP. It also contains
rename-report.csv, which records every old and new name. In Chrome or Edge you can rename in place in a local folder, with an undo for the last run.
If the files are in Google Drive but don't need to stay there unchanged: select them in Drive and choose Download. Drive packs several files into a ZIP (very large selections are split into more than one). Drop that ZIP into Mass Rename, download the renamed ZIP and upload the results. Uploaded files are new Drive files, so old sharing links will not point to them.
Nothing in this route is uploaded by Mass Rename: the sheet and files are processed inside your browser tab.
5. Renaming files inside Google Drive with Apps Script
If the files must keep their Drive IDs and sharing links, rename them in place with a short script. In your sheet open Extensions → Apps Script and paste:
function listFolder() {
const folderId = 'PASTE_FOLDER_ID_HERE';
const files = DriveApp.getFolderById(folderId).getFiles();
const out = [['File ID', 'Old name', 'New name']];
while (files.hasNext()) {
const f = files.next();
out.push([f.getId(), f.getName(), '']);
}
SpreadsheetApp.getActiveSheet().getRange(1, 1, out.length, 3).setValues(out);
}
function renameFromSheet() {
const rows = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for (let i = 1; i < rows.length; i++) {
const id = rows[i][0];
const newName = String(rows[i][2]).trim();
if (id && newName) DriveApp.getFileById(id).setName(newName);
}
}
The folder ID is the last part of the folder's URL, after /folders/. Run listFolder
on an empty tab, fill column C, then run renameFromSheet and approve the permissions prompt.
Unlike Mass Rename, Drive does not keep the extension for you: the new name must include it
(q3-report.pdf, not q3-report).
Script caveats. There is no preview, no conflict check and no undo, and Drive happily allows two files with the same name. Try it on a copy of the folder first. Long runs can hit Apps Script's execution time limit; if that happens, run it again on the remaining rows.
Which route to use
| Download + Mass Rename | Apps Script in Drive | |
|---|---|---|
| Files on your computer | Yes | No |
| Keeps Drive IDs and share links | No (re-upload) | Yes |
| Preview, conflict and illegal-name checks | Yes | Write your own |
| Undo | Last in-place rename (Chrome/Edge) | No |
| Coding | None | Paste and run a script |
Frequently asked questions
Can I rename files directly from a Google Sheets link?
Not with Mass Rename: download the sheet first with File → Download as .xlsx or .csv, then drop that file into the tool. To rename files that live in Google Drive without downloading them, use the Apps Script shown in this guide.
Do formulas in Google Sheets work?
Yes. When you download the sheet as .xlsx or .csv, Google exports each formula's result, and that value is used as the new name.
Which tab is used if my spreadsheet has several?
A .xlsx download contains every tab and Mass Rename lets you pick one. A .csv download contains only the tab you had open.
Does the new name need the file extension?
Not in Mass Rename: the file keeps its own extension, whether or not you type one. In Google Drive via Apps Script, yes: setName replaces the whole name, extension included.
What happens if two rows produce the same new name?
Mass Rename marks both as a name conflict and skips them, rather than letting one overwrite the other. Fix the sheet and drop it in again.
Are my files sent to Google or to Mass Rename?
Your sheet stays in your Google account as usual. When you rename with Mass Rename, the downloaded sheet and your files are read inside your browser tab and nothing is uploaded.
Prefer it one click away? Mass Rename also runs as a browser extension: Add to Chrome · Add to Edge. The first 50 files in every batch are free; unlimited is $19 once.
Next: renaming from an Excel list · renaming from a CSV · batch rename on Mac and Windows · get a list of file names into Excel · renaming photos from a list · all guides