after upgrading to Ventura I can no longer covert a numbers spreadsheet to excel when I try to email it.

How to send an email that is in numbers and convert it to excel for the recipient?

After the upgrade to Ventura the process no longer offers the option to convert to excel.


MacBook Air 13″, macOS 13.0

Posted on Nov 17, 2022 12:58 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 17, 2022 2:48 PM

The ability to directly attach a Numbers document as an Excel spreadsheet to an e-mail has beeb removed from the latest version of Numbers. You now have to export the Numbers document as Excel then attach that to a new e-mail message.

18 replies

Nov 19, 2022 9:05 AM in response to hslipsky

I have written an AppleScript that exports the Numbers spreadsheet content to your interactive choice of PDF, Excel, or CSV documents and then automagically opens a new Mail message with same document attached. It can be run with an open document in Numbers, or run without Numbers and it will pop a file chooser over the default Numbers template chooser. You then select the Numbers document, it gets exported and attached to new Mail per above.


I have tested this with Numbers v12.2 on Ventura 13.0.1 and have no reason to believe it would not work on Monterey too, though my Numbers v12.2 still retains its Send A Copy feature as a File menu item or as an optional toolbar tool. It also works in a Shortcuts Run AppleScript and the Shortcuts allows you to save it to your Dock for one-click launch.


Here is the AppleScript that you can copy/paste into Dock > Launchpad > Other > Script Editor, then click the hammer icon on the Script Editor and then run the script to test it for yourself.


use scripting additions

property exportOptions : {"PDF", "Excel", "CSV"}
property extDict : {apdf:"PDF", msexcel:"xlsx", acsv:"csv"}

property theSender : " "
property theRecipients : ""

tell application "Numbers"
	activate
	if not (exists front document) is true then
		set nbr_doc to (choose file of type {"Numbers"} default location (path to desktop)) as text
		set thisDoc to open nbr_doc as alias
	else
		set thisDoc to front document
	end if
	
	set docPath to (thisDoc's file) as text
	set basename to text 1 thru ((offset of "numbers" in docPath) - 1) of docPath
	-- you can press return instead of clicking the OK button
	set exportFormat to (choose from list exportOptions ¬
		with title "Spreadsheet Export Options" default items {"Excel"})
	
	if exportFormat is false then return
	
	-- export chosen document format
	with timeout of 1200 seconds
		if exportFormat contains "Excel" then
			set expDoc to basename & msexcel of extDict
			export thisDoc to file expDoc as Microsoft Excel
		else if exportFormat contains "CSV" then
			set expDoc to basename & acsv of extDict
			export thisDoc to file expDoc as CSV
		else
			set expDoc to basename & apdf of extDict
			export thisDoc to file expDoc as PDF with properties {image quality:Best}
		end if
	end timeout
	
	tell application "Numbers" to if it is running then quit
	
	-- ensure exported file extension is visible in the Finder as by default it is not
	tell application "Finder"
		try
			if exists (item expDoc as alias) then
				set extension hidden of (item expDoc as alias) to false
			end if
		end try
	end tell
end tell

set theRecipeients to {" "}
set theAttachment to (alias expDoc)
set theContent to "Test content" & return & return & "Attachment:" & return
log (theAttachment) as text

tell application "Mail"
	activate
	
	set theMessage to (make new outgoing message with properties {visible:true, subject:"File Attachment test", content:theContent & return & return})
	tell theMessage to (make new to recipient with properties {address:theRecipients})
	
	tell theMessage
		tell content to make new attachment with properties {file name:theAttachment} at after the last paragraph of it
	end tell
	delay 1
	# send theMessage
end tell


To build a solution as a macOS Shortcut app, you do the following:


  1. Dock > Launchpad > Other > Shortcuts
  2. Shortcuts > New Shortcut

3. Enter run in the search field and choose Run AppleScript from the results. Click on Run AppleScript, then the i⃝ symbol and choose [ + Add to Shortcut ]

4. Click in front of the on run {input, parameters} line and press return. Copy and paste the use scripting additions and two property statements before the on run {input, parameters} clause. Press return afterward to open up an empty line. Click the hammer icon. It will now look like this:



5. Select the single line that says (* Your script goes here *) and leave it selected. Then copy/paste the rest of the above AppleScript source from the first tell statement to the end of the script onto that selection. Click the hammer icon to compile this Shortcuts Run AppleScript. Now the finished Shortcut will look like this, since I cannot expand the shortcut window to select as I did above and perform a screen shot. See my second post (Part II) to this thread that avoids the 5000 character limit that blocked posting the full Shortcut code.


End of Part I.

Nov 19, 2022 9:16 AM in response to VikingOSX

Part II.


The finished Shortcut will look like the following:


use scripting additions

property exportOptions : {"PDF", "Excel", "CSV"}
property extDict : {apdf:"PDF", msexcel:"xlsx", acsv:"csv"}

on run {input, parameters}
	tell application "Numbers"
		activate
		if not (exists front document) is true then
			set nbr_doc to (choose file of type {"Numbers"} default location (path to desktop)) as text
			set thisDoc to open nbr_doc as alias
		else
			set thisDoc to front document
		end if
		
		set docPath to (thisDoc's file) as text
		set basename to text 1 thru ((offset of "numbers" in docPath) - 1) of docPath
		-- you can press return instead of clicking the OK button
		set exportFormat to (choose from list exportOptions ¬
			with title "Spreadsheet Export Options" default items {"Excel"})
		
		if exportFormat is false then return
		
		-- export chosen document format
		with timeout of 1200 seconds
			if exportFormat contains "Excel" then
				set expDoc to basename & msexcel of extDict
				export thisDoc to file expDoc as Microsoft Excel
			else if exportFormat contains "CSV" then
				set expDoc to basename & acsv of extDict
				export thisDoc to file expDoc as CSV
			else
				set expDoc to basename & apdf of extDict
				export thisDoc to file expDoc as PDF with properties {image quality:Best}
			end if
		end timeout
		
		tell application "Numbers" to if it is running then quit
		
		-- ensure exported file extension is visible in the Finder as by default it is not
		tell application "Finder"
			try
				if exists (item expDoc as alias) then
					set extension hidden of (item expDoc as alias) to false
				end if
			end try
		end tell
	end tell
	
	set theRecipients to {" "}
	set theAttachment to (alias expDoc)
	set theContent to "Test content" & return & return & "Attachment:" & return
	log (theAttachment) as text
	
	tell application "Mail"
		activate
		
		set theMessage to (make new outgoing message with properties {visible:true, subject:"File Attachment test", content:theContent & return & return})
		tell theMessage to (make new to recipient with properties {address:theRecipients})
		
		tell theMessage
			tell content to make new attachment with properties {file name:theAttachment} at after the last paragraph of it
		end tell
		delay 1
		# send theMessage
	end tell
	return input
end run


At this point, you can click the ▶︎ to run the Shortcut. I renamed mine (arbitrary name) from the Shortcuts menu, and then closed it to save it in my All Shortcuts category which will appear after the close. I recommend that you use a name like Numbers > Send a Copy for the Shortcut.



You can now right-click on the Shortcut and choose Add to Dock for single-click access to it, or you can drag a copy of it over the Menu Bar menu item and access it from your Shortcuts menus extra location:



Quit the Shortcuts application.

Dec 5, 2022 9:36 AM in response to VikingOSX

Ok. I found the cause. When you select a document from the Numbers folder on iCloud Drive, the string "numbers" appears in the filename path twice. The AppleScript offset syntax finds the first occurrence of "numbers" which would be .numbers in a document on the local drive. On iCloud Drive > Numbers folder, you have a path string that looks like this:


Macintosh HD:Users:viking:Library:Mobile Documents:com~apple~Numbers:Documents:hex.numbers


and the offset command is matching the first case-insensitive occurrence of Numbers and the basename is now:


Macintosh HD:Users:viking:Library:Mobile Documents:com~apple~


which is incorrect.


Change the line:


property extDict : {apdf:"PDF", msexcel:"xlsx", acsv:"csv"}


to:


property extDict : {apdf:".pdf", msexcel:".xlsx", acsv:".csv"}


and change:


set basename to text 1 thru ((offset of "numbers" in docPath) - 1) of docPath


to:


set basename to text 1 thru ((offset of ".numbers" in docPath) - 1) of docPath


Click the hammer (compile) button in the Shortcut before choosing Close on the Shortcut File menu to save the changes.


These fixes now allow one to select a Numbers document from either the local drive, or the iCloud Drive synced Numbers folder and attach it to a Mail compose window. I tested this again in my revised Shortcut and it worked correctly.



Nov 29, 2022 5:53 AM in response to Gaijingirl8

Yes. Same issue in Pages. As fellow users, we have no way of knowing the thought processes and rationale for removal of legacy features from Numbers or Pages. Those product teams do not particpate in these public, Google archived communities either, though you can send feedback to them directly via the application's menu.


I did write a similar solution for Pages v12.2 as I did above for Numbers v12.2 that will export and automatically attach PDF, Word, or RTF documents to an outgoing email. See PAGES: Where did "share as pdf" go? - Apple Community


Nov 30, 2022 8:17 AM in response to VikingOSX

I have revised this solution to allow exporting from Numbers v12.2.1 to the old Excel 97 - 2003 binary XLS document format. It tests to see if LibreOffice is installed and if true, proceeds to convert the exported XLSX document to an XLS bearing the same name in the same location — then automatically attaches the XLS document as an email attachment.

Dec 5, 2022 9:02 AM in response to rosscopeak

Still experimenting with Numbers documents saved on iCloud Drive. First attempt, no error dialogs, and no document attached to the Mail compose window. Will have to run the code in the Script Editor again so I can trace the progress and see what is not working. Stay tuned.


Update: Just pulled and commented the Shortcut AppleScript code into Script Editor, ran it choosing an Numbers document that I copied to iCloud Drive (not in the Numbers folder there), and the script worked fine, without errors, to attach the Excel .xlsx document to the email.


I will now enable iCloud > iCloud Drive > Options > Numbers syncing and run it again on a document inside that iCloud Drive Numbers folder to see that result.

Dec 5, 2022 2:18 AM in response to VikingOSX

Thank you so much for taking the time to do this.


I am a first time user of shortcuts.


My script reads the same as yours I think but I get an error


use scripting additions


property exportOptions : {"PDF", "Excel", "CSV"}

property extDict : {apdf:"PDF", msexcel:"xlsx", acsv:"csv"}


on run {input, parameters}

tell application "Numbers"

activate

if not (exists front document) is true then

set nbr_doc to (choose file of type {"Numbers"} default location (path to desktop)) as text

set thisDoc to open nbr_doc as alias

else

set thisDoc to front document

end if

set docPath to (thisDoc's file) as text

set basename to text 1 thru ((offset of "numbers" in docPath) - 1) of docPath

-- you can press return instead of clicking the OK button

set exportFormat to (choose from list exportOptions ¬

with title "Spreadsheet Export Options" default items {"Excel"})

if exportFormat is false then return

-- export chosen document format

with timeout of 1200 seconds

if exportFormat contains "Excel" then

set expDoc to basename & msexcel of extDict

export thisDoc to file expDoc as Microsoft Excel

else if exportFormat contains "CSV" then

set expDoc to basename & acsv of extDict

export thisDoc to file expDoc as CSV

else

set expDoc to basename & apdf of extDict

export thisDoc to file expDoc as PDF with properties {image quality:Best}

end if

end timeout

tell application "Numbers" to if it is running then quit

-- ensure exported file extension is visible in the Finder as by default it is not

tell application "Finder"

try

if exists (item expDoc as alias) then

set extension hidden of (item expDoc as alias) to false

end if

end try

end tell

end tell

set theRecipients to {" "}

set theAttachment to (alias expDoc)

set theContent to "Test content" & return & return & "Attachment:" & return

log (theAttachment) as text

tell application "Mail"

activate

set theMessage to (make new outgoing message with properties {visible:true, subject:"File Attachment test", content:theContent & return & return})

tell theMessage to (make new to recipient with properties {address:theRecipients})

tell theMessage

tell content to make new attachment with properties {file name:theAttachment} at after the last paragraph of it

end tell

delay 1

# send theMessage

end tell

return input

end run



Any further advice?

Thank you

Jan 9, 2023 5:18 AM in response to VikingOSX

I have followed your steps and created the shortcut. It all looks the same as yours. But I get the following error message..


Numbers got an error: The document “Updates (All Markets)” could not be exported as “missing value”. 


I am unsure what the missing value is or could be. The following is the script of the shortcut. This too is my first attempt at creating a "runscript shortcut". I have gone through the steps many times and it keeps giving me the same error. I appreciate any tips. I am running Ventura 13.0.1 with number version 12.2.1 (7035.0.161)


use scripting additions


property exportOptions : {"PDF", "Excel", "CSV"}

property extDict : {apdf:".pdf", msexcel:".xlsx", acsv:".csv"}


on run {input, parameters}

tell application "Numbers"

activate

if not (exists front document) is true then

set nbr_doc to (choose file of type {"Numbers"} default location (path to desktop)) as text

set thisDoc to open nbr_doc as alias

else

set thisDoc to front document

end if

set docPath to (thisDoc's file) as text

set basename to text 1 thru ((offset of ".numbers" in docPath) - 1) of docPath

-- you can press return instead of clicking the OK button

set exportFormat to (choose from list exportOptions ¬

with title "Spreadsheet Export Options" default items {"Excel"})

if exportFormat is false then return

-- export chosen document format

with timeout of 1200 seconds

if exportFormat contains "Excel" then

set expDoc to basename & msexcel of extDict

export thisDoc to file expDoc as Microsoft Excel

else if exportFormat contains "CSV" then

set expDoc to basename & acsv of extDict

export thisDoc to file expDoc as CSV

else

set expDoc to basename & apdf of extDict

export thisDoc to file expDoc as PDF with properties {image quality:Best}

end if

end timeout

tell application "Numbers" to if it is running then quit

-- ensure exported file extension is visible in the Finder as by default it is not

tell application "Finder"

try

if exists (item expDoc as alias) then

set extension hidden of (item expDoc as alias) to false

end if

end try

end tell

end tell

set theRecipeients to {" "}

set theAttachment to (alias expDoc)

set theContent to "Test content" & return & return & "Attachment:" & return

log (theAttachment) as text

tell application "Mail"

activate

set theMessage to (make new outgoing message with properties {visible:true, subject:"File Attachment test", content:theContent & return & return})

tell theMessage to (make new to recipient with properties {address:theRecipients})

tell theMessage

tell content to make new attachment with properties {file name:theAttachment} at after the last paragraph of it

end tell

delay 1

# send theMessage

end tell

return input

end run


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

after upgrading to Ventura I can no longer covert a numbers spreadsheet to excel when I try to email it.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.