Message Boards Message Boards

0
|
4941 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How to import a ".numbers" spreadsheet?

Hi folks,

Edit: Cross-posted on Mathematica StackExchange, yielding this slick applescript-based solution: http://mathematica.stackexchange.com/questions/36764/how-to-import-a-numbers-spreadsheet 

Does Mathematica support importing a ".numbers" spreadsheet file (from the "Numbers" spreadsheet program in Apple's OS X iWork office suite)?

For MS Office Excel, Mathematica supports importing various types of data from Excel's .xls files:

In[33]:= Import["~/foo.xls", "Elements"]
Out[33]= {"Data", "FormattedData", "Formulas", "Images", "Sheets"}

However, for a ".numbers" file, the options are much more limited:

In[34]:= Import["~/foo.numbers","Elements"]
Out[34]= {FileNames}
In[35]:= Import["~/foo.numbers","FileNames"]
Out[35]= {QuickLook/Thumbnail.jpg,buildVersionHistory.plist,index.xml}

Furthermore, none of these three elements is the data in a simple form.

Obviously I could use Numbers to convert foo.numbers into foo.xls. That is undesirable.

But is there a way to import a foo.numbers file within Mathematica? 

Thanks,
Justin
POSTED BY: Justin Pearson
4 Replies
This was cross-posted and answered HERE.
POSTED BY: Moderation Team
Unfortunately I have never tried; I always opted for exporting a .numbers file to csv, and reading that in. Good luck figuring out how it is stored.
POSTED BY: Sander Huisman
Hi Justin,

The .numbers file are actually just zip files. try renaming the file top .zip and you can unzip them.
I'm not sure how the data is stored, but try unzipping and get 1 `layer' closer.
POSTED BY: Sander Huisman
Hi Sander,

Yes, you are correct -- it is just a zip file:

 $ file foo.numbers
 foo.numbers: Zip archive data, at least v2.0 to extract
 
 $ unzip -t foo.numbers
 Archive:  foo.numbers
     testing: QuickLook/Thumbnail.jpg   OK
     testing: buildVersionHistory.plist   OK
     testing: index.xml                OK
 No errors detected in compressed data of foo.numbers.

I suppose that is why Mathematica reports that the only Import-able "Elements" are the filenames contained in the zip file.

The spreadsheet's data is stored in index.xml. 

Although it would be technically possible for me to parse it myself, I imagine a tool already exists for that. Thoughts?

Thanks,
Justin
POSTED BY: Justin Pearson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract