FUNCTION REFERENCE
xlsread
Read numbers, text and raw cells from a spreadsheet (legacy form).
Read numbers, text and raw cells from a spreadsheet (legacy form).
Syntax
num = xlsread('book.xlsx')Syntax
[num, txt, raw] = xlsread('book.xlsx', sheet)Syntax
[num, txt, raw] = xlsread('book.xlsx', sheet, 'A1:C10')Syntax
num = xlsread('book.xlsx', 'B2:D5')Reads .xlsx, .xlsm, .xlsb or .xls files. sheet is a sheet name or 1-based index ('' or omitted: the first sheet); a single text argument containing ':' is a range of the first sheet. num is the smallest rectangle holding every numeric or logical cell, with NaN for the others; txt is the smallest rectangle holding every text cell, with '' for the others; raw is every cell of the read area, with numbers as double, logical cells as logical, text as character vectors and empty cells as NaN. A fourth input 'basic' is accepted and changes nothing.
Example
[num, txt] = xlsread('book.xlsx', 'Data') % numbers and header text of sheet DataDifferences from MATLAB: No Excel automation: no interactive selection (-1), no custom processing function and no formula evaluation (stored cached results are read). Error cells read as NaN; dates read as Excel serial numbers. raw is limited to 65536 cells; an .xls workbook is read whole and is limited to 16777216 cells over all its sheets.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.