Why does XLSREAD return errors with some spreadsheets on non-Windows platforms in MATLAB 7.6 (R2008a)?

15 views (last 30 days)
I am attempting to use XLSREAD to import data from an Excel file on MAC OS 10.5, but have been unsuccessful. On executing XLSREAD on a certain XLS-file, I see several lines in the MATLAB Command Window that read as follows:
Skipping 16 bytes of extended strings
Skipping 16 bytes of extended strings
Skipping 16 bytes of extended strings
[snip]
Before generating one of the following errors:
??? Specified worksheet was not found
or
??? File could not be read by biffparse. Invalid record ID.
However, the same syntax will work on a Windows machine. I have also tried using the 'basic' mode with no success.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability to unrestrictedly import data from all Microsoft Excel formats using the 'basic' mode is not available in MATLAB 7.6 (R2008a).
As stated in our documentation: The full functionality of XLSREAD depends on the ability to start Excel as a COM server from MATLAB. If your system does not have this capability (as on a non-Windows platform such as a Mac or Linux machine), the XLSREAD syntax that passes the 'basic' keyword is recommended. As long as the COM server is available, you can use XLSREAD on Excel files having formats other than XLS (for example, HTML).
Unfortunately, due to the evolving nature of Microsoft Excel file formats, it is difficult to have the 'basic' mode (which invokes the private function BIFFPARSE) support all possible Excel formats. Therefore, this mode has some fundamental limitations.
In order to work around this issue, save all errant XLS-files in Microsoft Excel 95 format. This ensures that all unsupported formatting is eliminated from the file, thus rendering it readable by the XLSREAD function in 'basic' mode.
  2 Comments
Walter Roberson
Walter Roberson on 22 Nov 2018
Alternatives for Mac and Linux:
  • Use readtable()
  • Use OfficeLibre or similar to open the file and safe a copy as Office 95 compatible
  • Use Virtual Machine software such as Wine or Parallels to run an instance of MS Windows with MATLAB and Excel installed and command the virtual machine to do the reading for you and transfer it over to the Mac / Linux instance.

Sign in to comment.

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

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

Start Hunting!