xlsread on Mac in basic mode

8 views (last 30 days)
Angry Sloth
Angry Sloth on 5 Nov 2013
Answered: Marc on 12 Nov 2013
I'm having issues with the xlsread function. I am using Matlab and excel in Mac OSX. So far I understand that in the Mac environment, Matlab must use basic mode to import. I thought I'd accounted for this in my script. I've also changed the file type of the source excel workbook to be 98 compatible
This is the content of my script:
_clc clear
[num,txt,raw] = xlsread('VSim.xls','Sheet1','','basic')_
This is the displayed error messages:
_Warning: XLSREAD has limited import functionality on in basic mode. Refer to HELP XLSREAD for more information. > In xlsread at 168 In exc at 4 Error using xlsread (line 232) XLSREAD unable to read sheet Sheet1. File could not be read by biffparse. Invalid record ID.
Error in exc (line 4) [num,txt,raw] = xlsread('VSim.xls','Sheet1','','basic')_
Thanks in advance.
Is there any solution to this problem?
Chris

Answers (2)

Ken Atwell
Ken Atwell on 6 Nov 2013
What version of MATLAB are you using? The last handful of releases can read .xlsx files, give it a try.
  2 Comments
Angry Sloth
Angry Sloth on 8 Nov 2013
Im using 2011 on my mac. Im trying the xlsread function and the same thing happens all the time... It works whenever I do it with windows but it just doesn't seem to work on my mac.
Ken Atwell
Ken Atwell on 12 Nov 2013
Gotcha. The XLSX support I am referring to was added in R2012a, sorry.

Sign in to comment.


Marc
Marc on 12 Nov 2013
You are not going to like this answer. I am using Mac OS X 10.8.5, Office for Mac 2011. When I was developing this "code", it was with 2012b on Windows 7 at work. Since my license allows me to work at home, I tried it on my Mac. To get it to work, I saved the excel file as a .xlsm extension. So, here are the errors I get for 2010a, 2012b and 2013b depending on the file extension.
2010a gives me an error whether I save the file as .xls or .xlsm. .xlsm error first...
% -----------------------------------------------------------------------------------------
Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 ??? Error using ==> xlsread at 234 File contains unexpected record length. Try saving as Excel 98.
Error in ==> unit9_dataReadRaw at 13 [data{i},text{i}] = xlsread(filename, sheets{i}, 'A1:S130');
% -------------------------------------------------------------------
2010a with an .xls file extension
% -------------------------------------------------------------------
Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 184 In unit9_dataReadRaw at 13 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 16 Warning: Could not start Excel server for import, 'basic' mode will be used. Refer to HELP XLSREAD for more information. > In xlsread at 176 In unit9_dataReadRaw at 17 ??? Error using ==> xlsread at 234 XLSREAD unable to read sheet LOADING. File contains unexpected record length. Try saving as Excel 98.
Error in ==> unit9_dataReadRaw at 17 [loadDat, loadText] = xlsread(filename, 'LOADING');
% ------------------------------------------------------------
In 2012b, the only error I get is with the .xls file
Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 199 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 199 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 199 In unit9_dataReadRaw at 13 Error using xlsread (line 247) XLSREAD unable to read sheet 'LOADING'. File contains unexpected record length. Try saving as Excel 98.
Error in unit9_dataReadRaw (line 17) [loadDat, loadText] = xlsread(filename, 'LOADING');
>>
% -----------------------------------------------------------------
In 2013b, looking for the .xls file, I get the following error. Both 2012b and 2013b give me no issues with the same file saved as .xlsm.
Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 201 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 201 In unit9_dataReadRaw at 13 Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded. > In xlsread at 201 In unit9_dataReadRaw at 13 Error using xlsread (line 248) XLSREAD unable to read sheet 'LOADING'. File contains unexpected record length. Try saving as Excel 98.
Error in unit9_dataReadRaw (line 17) [loadDat, loadText] = xlsread(filename, 'LOADING');
% --------------------------------------------------------------------
As you can see the errors point to different lines in 2012b and 2013b. I try not to think about it when I go to sleep. A nice 12 year old scotch helps.....

Tags

Community Treasure Hunt

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

Start Hunting!