AppleScript - Batch Export Numbers to Excel
Previously I've used the AppleScript below successfully to create Microsoft Excel versions alongside all Numbers docs in a selected folder.
Now it spits out: "Numbers got an error: Invalid key form."
I've tried changing the .xls extension to .xlsx but same issue. Any suggestions on an update / edit / different approach?
Running on: MacOS Monterrey 12.0., Numbers 12
Script ---
on run {input, parameters}
set theFolder to choose folder
tell application "Finder" to set theDocs to theFolder's items
repeat with aDoc in theDocs
set docName to aDoc's name as text
if docName ends with ".numbers" then
set exportName to (theFolder as text) & docName
set exportName to exportName's text 1 thru -9 & ".xlsx"
tell application "Numbers"
open aDoc
delay 2.5 -- may need to adjust this higher
tell front document
close access (open for access exportName)
export to file exportName as Microsoft Excel
close
end tell
end tell
end if
end repeat
return input
end run
--
iMac 27″, 12.0