Attach unique attachment to email using apple script to send email to different users
set theWorkbookFile to choose file with prompt &quot;Please select an Excel workbook file:&quot;
set theWorkbookName to name of (info for theWorkbookFile)
tell application &quot;Microsoft Excel&quot;
open theWorkbookFile
set theWorkbook to workbook theWorkbookName
set peremail to value of used range of active sheet
end tell
--This is the part that I am stuck on???--
tell application &quot;Finder&quot;
activate
set theAttachmentFile to every file of &quot;Macintosh HD:Users:j:Box:Email test:&quot;whose name contains (peremail as Unicode text) -- the attachment path
end tell
repeat with aRow in peremail
set {theEmail, theName} to aRow
tell application &quot;Mail&quot;
set newMessage to make new outgoing message with properties {sender:thesender, subject:&quot;Order&quot;}
tell newMessage
set content to &quot;XXXX&quot;
make new to recipient at end of to recipients with properties {name:theName, address:theEmail}
tell content of newMessage
            make new attachment with properties {file name:theAttachmentFile as alias} at after the last word of the last paragraph
            
        end tell
        delay 3
        
    end tell
    
end tell

end repeat