# Exporting a .xlsx file with about 500 columns

When I want to Export["text.xlsx", data] where data is a matrix with 500 columns and 10000 rows, I get the error message:

Export::toomany3: "Cannot export to !(\"XLSX\"). The number of columns exceeds the limit of this format."

However, if I write the data as csv and load it into excel, everything works. Is there a way to write the data of this size to xlsx directly?

Test sample:

data = RandomReal[{-1, 1}, {10000, 500}];
Export["test.xlsx", data]


This happens with Mathematica 8 and 9 and 10.

-
Have you tried xls? Probably best to just use csv. If MMA can't export as xlsx then unless they patch it I don't think you can solve it. –  s0rce Mar 8 '13 at 18:00
Are you sure the v9 tag is appropriate? This would suggest that it works in v8... Since xlsx is "just" an xml file you could in theory get around this. But definitely not worth the effort. Also, contact support@wolfram.com and report this as a bug. superuser.com/questions/366468/… –  Ajasja Mar 8 '13 at 18:08
Should we tag as bug? –  Ajasja Mar 8 '13 at 22:51
@SjoerdC.deVries Excel has enough bugs to claim compatibility with any other buggy software –  belisarius Mar 8 '13 at 23:53
@AndreasLauschke I don't agree: the xlsx file format specification supports 1,048,576 rows and 16,384 columns. So in mma you either have to mention you don't fully support it, or fix the limits. Whether it is a good idea to export such large data to xlsx or not is beside the point. –  Ajasja Mar 9 '13 at 16:05

I wrote to Wolfram's support and they answered with a link about "Excel 2007 features that are not supported in earlier versions of Excel". I can not see clearly how this connects to Mathematica's support of Excel 2007 features. However, my suggestion to fully support XLSX has been forwarded to Wolfram's developers.

-
Yes, the support answer is not useful at all. Looks like the Wolfram developers are still very busy with fully supporting XLSX, since in 10.0.1 it seems not to work (at least on Windows). –  Rolf Mertig Oct 15 '14 at 11:19

According to

http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx

this is no bug in MM. It is the spec limit of an Excel sheet. Thus you have to split your export. Maybe you want to rethink the data structure?

Edit: Applies to Excel 2003. For excel 2010 the limits were extended:

http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010342495.aspx?CTT=5&origin=HP005199291

Thus it is not exactly a bug. It is more a feature request since Wolfram should adopt to the new limits.

-
Actually 2003 does not natively support xlsx files, the file format we are talking about. –  Ajasja Mar 9 '13 at 16:01
Even if they don't wish to add support for more than 255 columns, the objection that "the number of columns exceeds the limit of this format" is clearly incorrect--thus I think calling it a bug is appropriate in this case. Limitations placed on other formats by Mathematica's capabilities rather than the format itself are clearly stated in the documentation, which obviously is not the case here. –  Oleksandr R. Mar 9 '13 at 20:53