rename files from excel spreadsheet & add data/keywords to image file

Goal. To take the image file and rename to new file name. Then add relevant keyword data to IPTC core Data.

the spreadsheet. E1 contains the original filename. F1 contains the filename it needs to be named to and then G1 contains a description of the image. (this i would like to add to the IPTC data.

I would need it to ask for the folder location of the images to be renamed and then prompt for the xls file (i’m using 2011)

in the spreadsheet the original file names would not be in any particular order. and so would need to search the spreadsheet to find it.

I did find some renaming scripts but cannot get them to work.

I hope someone can help me out here.

Thanks in advance


This is what i have begun to use to start the renaming. I found it from another post. Currently it opens the file and then asks to save changes to the excel file and then nothing else appears to happen.

The files I am trying to rename are jpg’s and png’s.

set excelFile to choose file with prompt "Choose the Excel file" of type {"XLS6", "XLS7", "XLS8", "XLSX"}
set theFolder to choose folder with prompt "Choose the folder containing the files to rename"

--get a list of the old and the new filenames
set oldnames to {}
set newnames to {}
tell application "Microsoft Excel"
	open excelFile
	tell document 1
		tell sheet 1
			repeat with i from 1 to 9999
				if value of cell ("F" & i as text) ≠ "" then
					set oldnames to oldnames & value of cell ("E" & i as text)
					set newnames to newnames & value of cell ("F" & i as text)
					exit repeat
				end if
			end repeat
		end tell
	end tell
	close window 1
end tell
--loop through the files and rename them.
tell application "Finder"
	repeat with k from 1 to (count of (get every item of theFolder))
		repeat with i from 1 to count of oldnames
			if (name of item k of theFolder) as text = (item i of oldnames) as text then
				set name of (item k of theFolder) to (item i of newnames as text)
			end if
		end repeat
	end repeat
end tell