Hallo all,
Does anyone know how to turn off category in numbers while exporting to xlsx with this script
this script works for me but I would have to manually turn it off before executing the script.
including that in the script would be the best.
property theFile : alias POSIX file "/Users/camel/Desktop/Scanns/attachment.numbers"
SendAttachment(theFile)
on SendAttachment(theFile)
tell application "Finder"
set documentName to the name of theFile
if documentName ends with ".numbers" then set documentName to text 1 thru -9 of documentName
set XLSXExportFileName to documentName & ".xlsx"
set folderPath to (container of theFile) as text
set the XLSXtargetFileHFSPath to folderPath & XLSXExportFileName
end tell
tell application "Numbers"
activate
set docRef to open theFile
set XLSXtargetFileHFSPath to XLSXtargetFileHFSPath as «class furl»
close access (open for access XLSXtargetFileHFSPath) # Required for 10.12 thru 10.12.3. Don't hurt with 10.12.4 & 5
export docRef to XLSXtargetFileHFSPath as Microsoft Excel
close docRef without saving
end tell
end SendAttachment
Backticks for formatting AppleScript code on this site added by NG. See Markdown reference here.
I did this with your code and seem to keep getting “invalid index." number -1719 from document 1”
Also added soms delays but it didn’t help.
Am on Ventura 13.4.1
property theFile : alias POSIX file "/Users/casinoamsterdam/Desktop/Scanns/attachment.numbers"
SendAttachment(theFile)
on SendAttachment(theFile)
tell application "Finder"
set documentName to the name of theFile
if documentName ends with ".numbers" then set documentName to text 1 thru -9 of documentName
set XLSXExportFileName to documentName & ".xlsx"
set folderPath to (container of theFile) as text
set the XLSXtargetFileHFSPath to folderPath & XLSXExportFileName
end tell
tell application "Numbers"
activate
tell application "Numbers"
tell table 1 of sheet 1 of front document
-- dummy to get the selected table
set locked to false
end tell
end tell
tell application "System Events" to tell process "Numbers"
set frontmost to true
tell menu bar item "Organise" of menu bar 1
click menu item "Show Category Options" of menu 1
end tell
tell window 1
if value of button 4 is "on" then
click button 4
end if
end tell
end tell
set docRef to open theFile
set XLSXtargetFileHFSPath to XLSXtargetFileHFSPath as «class furl»
close access (open for access XLSXtargetFileHFSPath) # Required for 10.12 thru 10.12.3. Don’t hurt with 10.12.4 & 5
export docRef to XLSXtargetFileHFSPath as Microsoft Excel
close docRef without saving
end tell
end SendAttachment
Backticks for formatting AppleScript code on this site added by NG. See Markdown reference here.