Rename files using Excel - OldName / NewName

Hi


I have around 3000 images I need to rename.


I have a list of all the current images names in excel and have created a column next to them with the names I need them to be.


How do I do this?


I'm not super techy so assume it has to be a simple as possible please



MacBook Pro 13″, macOS 11.5

Posted on Oct 2, 2021 3:51 AM

Reply

Similar questions

5 replies

Oct 3, 2021 10:21 AM in response to 102monkeys

This python script will do what you want.

Copy the files to a new Folder on your Desktop (untitled folder on My Desktop in the script below).

Save As the Excel File to a CSV File (Book1.csv on My Desktop in the script below).

Run the script in Terminal, and the files in untitled folder should be renamed)


#!/usr/bin/python

import csv
import os

# Change to Directory with files (Be safe, Copy files to a new Folder)
os.chdir('/Users/Tony/Desktop/untitled folder')
# Rename from name in col 1 to name in col 2 in CSV File)
with open('/Users/Tony/Desktop/Book1.csv') as f:
	lines = csv.reader(f)
	for line in lines:
		try:
			os.rename(line[0], line[1])
		except:
			print(line[0] + ': File not found')

Oct 3, 2021 7:41 AM in response to 102monkeys

You can do this by first saving the Excel File as a CSV file, then using a script in Terminal to rename the files.


The safest way to do this is to create a new Folder on the Desktop and COPY the files there, so that originals are not worked on.


Export to a CSV file, then post the first few lines, starting with row 1 (even if this is the header file). Blank out any sensitive info with “xxx”.

With this info, we can help writing the script.

Oct 3, 2021 6:44 AM in response to 102monkeys

Hello 102monkeys,


Welcome to Apple Support Communities!

If we understand your post correctly, you want to know how to rename files using Excel. We're here to help!


Below are the steps on how to rename multiple items on your Mac. If you want to use Excel to rename these files, we recommend checking out Microsoft Excel support.

Excel help & learning


"Rename multiple items

  1. On your Mac, select the items, then Control-click one of them.
  2. In the shortcut menu, choose Rename.
  3. In the pop-up menu below Rename Finder Items, choose to replace text in the names, add text to the names, or change the name format.
    • Replace text: Enter the text you want to remove in the Find field, then enter the text you want to add in the “Replace with” field.
    • Add text: Enter the text you want to add in the field, then choose to add the text before or after the current name.
    • Format: Choose a name format for the files, then choose to put the index, counter, or date before or after the name. Enter a name in the Custom Format field, then enter the number you want to start with.
  1. Click Rename.

These are some items you should not rename:

  • App folders and any items that came with your system, such as the Library folder. (If you change the name of an item and experience problems, change the name back. If this doesn’t help, you may need to reinstall the software.)
  • Filename extensions—the period followed by a few letters or words that you see at the end of some filenames (for example, .jpg). If you change an extension, you may no longer be able to open the file with the app that was used to create it.
  • Your home folder—the one with your name on it."


Rename files, folders, and disks on Mac


Thank you for using Apple Support Communities.

Take care!


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Rename files using Excel - OldName / NewName

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.