I wrote this script for a coworker to move files based on fields in an excel sheet.
It works on my Mac with 2011 Excel, but his machine only has Excel v.X for mac (ancient, i know) I’m thinking that’s why he is getting an error at the open part.
the error message is:
Here’s my script that works on my machine. Obviously I changed a few locations to his desktop. Any assistance is greatly appreciated.
property firstRow : 2
set myDoc to (choose file with prompt "Select the Excel Spreadsheet to Convert:")
set myFolder to "Macintosh HD:Users:Grover:Desktop:Badge Test:"
set sourceFolder to "HOM:Products:Name Badges:Group Pictures:"
tell application "Microsoft Excel" to open myDoc
set x to firstRow
repeat
tell application "Microsoft Excel"
tell row x
set background to string value of cell 3
set COtext1 to value of cell 9
set COtext2 to value of cell 10
set title to value of cell 2
end tell
end tell
if background is "" then exit repeat
if COtext1 is "" and COtext2 is "" and title is "" then
set GPName to background & "-D.gp"
else if COtext1 is "" and COtext2 is "" and title is not "" then
set GPName to background & "-C.gp"
else if COtext1 is not "" and COtext2 is "" and title is not "" then
set GPName to background & "-B.gp"
else if COtext1 is not "" and COtext2 is not "" and title is not "" then
set GPName to background & "-A.gp"
else if COtext1 is not "" and COtext2 is not "" and title is "" then
set GPName to background & "-E.gp"
else if COtext1 is not "" and COtext2 is "" and title is "" then
set GPName to background & "-F.gp"
end if
set x to x + 1
tell application "Finder"
if not (exists file GPName of folder myFolder) then
duplicate file GPName of folder sourceFolder to folder myFolder
end if
end tell
end repeat