Read XLSX file on a Mac with R2012a doesn't work?

14 views (last 30 days)
Hi,
In the release notes of R2012a, it is said that Matlab can now read XLSX files on any platform. I'm working on Mac OS X Lion (10.7.3) with R2012a and MS Office 2011. When I save a file with Excel as an XLSX file, the matlab function xlsfinfo can't read it. But If I save it as an XLS file, it's Ok. The problem is that I want to use xlsread with specifying range to import. So according to the Help article on this function, I can't use the basic mode and thus, I have to use an XLSX file. But it doesn't work. Any help would be appreciated.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 27 Apr 2012
I'm not sure that the basic mode is specific to XLS or XLSX files. AFAIK, on Mac/Linux platforms, XLSREAD only works in basic mode. The reason is because in non-basic mode, XLSREAD needs to start Excel as a COM Server, which is a Windows-only technology.
  1 Comment
Friedrich
Friedrich on 30 Apr 2012
It should be possbile according to this solution:
http://www.mathworks.com/support/solutions/en/data/1-7JIS5B/index.html

Sign in to comment.

More Answers (2)

Ken Atwell
Ken Atwell on 30 Apr 2012
xlsread does indeed work with .xlsx files on the Mac beginning with R2012a.
Abdallah, let's put aside what xlsinfo may or may not be telling you, and focus on xlsread itself.
What does xlsread itself do? Does it work? If not, please post the exact error message you get from xlsread.

Abdallah
Abdallah on 17 May 2012
Hi,
Sorry for the delay...
It looks like I found a solution to my problem => not specifying range in my import and use XLS file format instead of XLSX. For example, here is the result I get when trying to read a file saved both as an XLS and an XLSX file :
>> [A,B]=xlsread('ReseauV4.xls','Généralités');
Warning: XLS File contains unrecognized string header - skipping remaining text - (1041:0x9f 63536).
>> [A,B]=xlsread('ReseauV4.xlsx','Généralités');
Error using xlsreadXLSX>sheetNameToIndex (line 210)
Worksheet 'Généralités' not found.
Error in xlsreadXLSX>getXLSXData (line 130)
sheetIndex = sheetNameToIndex(baseDir, sheet);
Error in xlsreadXLSX (line 9)
[sharedStrings, parsedSheetData, range] = getXLSXData(file, sheet, range);
Error in xlsread (line 233)
[numericData, textData, rawData] = xlsreadXLSX(file, sheet, range);
As you may see in this example, the XLS file is read (with a little warning due to special characters but it's ok) but not the XLSX file. What I don't understand is that there are the same data in them, I just saved the XLS file as an XLSX file.
So, considering not specifying range, XLS files reading "works better" than XLSX files reading.
  1 Comment
Walter Roberson
Walter Roberson on 17 May 2012
A couple of days ago someone reported that they had to use the worksheet number instead of the worksheet name.
I wonder: if the worksheet name were restricted to 7 bit characters (ASCII) whether it might work then?

Sign in to comment.

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!