I have a pipe delimited text file that I am trying to open in excel. On the attempt to execute the “open text file” command, I generate the following error:
I can’t think of what would be missing.
tell application "Microsoft Excel"
activate
-- open the data file.
set theData to choose file with prompt "Where is the data file?"
open text file theData data type delimited field info {{1, text format}} use other 1 other char "|"
end tell
Excel has some very non-intuitive ways of opening files with AppleScript. I tried adding open text file filename and then coercing the selected file to a string. Excel seems to be liking that better on my computer.
tell application "Microsoft Excel"
activate
-- open the data file.
set theData to choose file with prompt "Where is the data file?"
open text file filename (theData as string) data type delimited field info {{1, text format}} use other 1 other char "|"
end tell