xlsfinfo - Determine whether file contains Microsoft® Excel® (.xls) spreadsheet

Syntax

typ = xlsfinfo(filename)
[typ, desc] = xlsfinfo(filename)
[typ, desc, fmt] = xlsfinfo(filename)
xlsfinfo filename

Description

typ = xlsfinfo(filename) returns the string 'Microsoft Excel Spreadsheet' if the file specified by filename is an XLS file that can be read by the MATLAB® xlsread function. Otherwise, typ is the empty string, (''). The filename input is a string enclosed in single quotes.

[typ, desc] = xlsfinfo(filename) returns in desc a cell array of strings containing the names of each spreadsheet in the file. If a spreadsheet is unreadable, the cell in desc that represents that spreadsheet contains an error message.

[typ, desc, fmt] = xlsfinfo(filename) returns in the fmt output a string containing the actual format of the file as obtained from the Microsoft® Excel® COM server. On UNIX® systems, or on Windows® when the COM server is not available, fmt is returned as an empty string, ('').

xlsfinfo filename is the command format for xlsfinfo. It returns only the first output, typ, assigning it to the MATLAB default variable ans.

Examples

Get information about an .xls file:

[typ, desc, fmt] = xlsfinfo('myaccount.xls')

typ =
    Microsoft Excel Spreadsheet

desc = 
    'Sheet1'    'Income'    'Expenses'

fmt = 
    xlWorkbookNormal

Export the .xls file to comma-separated value (CSV) format. Use xlsfinfo to see the format of the exported file:

[typ, desc, fmt] = xlsfinfo('myaccount.csv');
fmt

fmt =
    xlCSV

Export the .xls file to HTML format. xlsfinfo returns the following format string:

[typ, desc, fmt] = xlsfinfo('myaccount.html');
fmt

fmt =
    xlHtml

Export the .xls file to XML format. xlsfinfo returns the following format string:

[typ, desc, fmt] = xlsfinfo('myaccount.xml');
fmt

fmt =
    xlXMLSpreadsheet

See Also

xlsread, xlswrite

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS