xlsread Read Microsoft Excel spreadsheet file. [NUM,TXT,RAW]=xlsread(FILE) reads data from the first worksheet in the Microsoft Excel spreadsheet file named FILE and returns the numeric data in array NUM. Optionally, returns the text fields in cell array TXT, and the unprocessed data (numbers and text) in cell array RAW. [NUM,TXT,RAW]=xlsread(FILE,SHEET) reads the specified worksheet. [NUM,TXT,RAW]=xlsread(FILE,SHEET,RANGE) reads from the specified SHEET and RANGE. Specify RANGE using the syntax 'C1:C2', where C1 and C2 are opposing corners of the region. Not supported for XLS files in BASIC mode. [NUM,TXT,RAW]=xlsread(FILE,SHEET,RANGE,'basic') reads from the spreadsheet in BASIC mode, the default on systems without Excel for Windows. RANGE is supported for XLSX files only. [NUM,TXT,RAW]=xlsread(FILE,RANGE) reads data from the specified RANGE of the first worksheet in the file. Not supported for XLS files in BASIC mode. The following syntaxes are supported only on Windows systems with Excel software: [NUM,TXT,RAW]=xlsread(FILE,-1) opens an Excel window to select data interactively. [NUM,TXT,RAW,CUSTOM]=xlsread(FILE,SHEET,RANGE,'',FUNCTIONHANDLE) reads from the spreadsheet, executes the function associated with FUNCTIONHANDLE on the data, and returns the final results. Optionally, returns additional CUSTOM output, which is the second output from the function. xlsread does not change the data stored in the spreadsheet. Input Arguments: FILE Name of the file to read. SHEET Worksheet to read. One of the following: * The worksheet name. * Positive, integer-valued scalar indicating the worksheet index. RANGE Character vector or string that specifies a rectangular portion of the worksheet to read. Not case sensitive. Use Excel A1 reference style. If you do not specify a SHEET, RANGE must include both corners and a colon character (:), even for a single cell (such as 'D2:D2'). 'basic' Flag to request reading in BASIC mode, which is the default for systems without Excel for Windows. In BASIC mode, xlsread: * Reads XLS, XLSX, XLSM, XLTX, and XLTM files only. * Does not support an xlRange input when reading XLS files. In this case, use '' in place of xlRange. * For XLS files, requires a name to specify the SHEET, and the name is case sensitive. * Does not support function handle inputs. * Imports all dates as Excel serial date numbers. Excel serial date numbers use a different reference date than MATLAB date numbers. -1 Flag to open an interactive Excel window for selecting data. Select the worksheet, drag and drop the mouse over the range you want, and click OK. Supported only on Windows systems with Excel software. FUNCTIONHANDLE Handle to your custom function. When xlsread calls your function, it passes a range interface from Excel to provide access to the data. Your function must include this interface (of type 'Interface.Microsoft_Excel_5.0_Object_Library.Range', for example) both as an input and output argument. Notes: * On Windows systems with Excel software, xlsread reads any file format recognized by your version of Excel, including XLS, XLSX, XLSB, XLSM, and HTML-based formats. * If your system does not have Excel for Windows, xlsread operates in BASIC mode (see Input Arguments). * xlsread imports formatted dates as character vectors (such as '10/31/96'), except in BASIC mode. In BASIC mode, xlsread imports all dates as serial date numbers. Serial date numbers in Excel use different reference dates than date numbers in MATLAB. For information on converting dates, see the documentation on importing spreadsheets. Examples: % Create data for use in the examples that follow: values = {1, 2, 3 ; 4, 5, 'x' ; 7, 8, 9}; headers = {'First', 'Second', 'Third'}; xlswrite('myExample.xls', [headers; values]); moreValues = rand(5); xlswrite('myExample.xls', moreValues, 'MySheet'); % Read data from the first worksheet into a numeric array: A = xlsread('myExample.xls') % Read a specific range of data: subsetA = xlsread('myExample.xls', 1, 'B2:C3') % Read from a named worksheet: B = xlsread('myExample.xls', 'MySheet') % Request the numeric data, text, and a copy of the unprocessed (raw) % data from the first worksheet: [ndata, text, alldata] = xlsread('myExample.xls') See also xlswrite, xlsfinfo, dlmread, importdata, textscan.