Main Content


Microsoft® Excel® spreadsheets

Read and write data in spreadsheet files, including .xls and .xlsx files into tables, timetables, matrices, or arrays in MATLAB®. You can import a selected range of data or you can import multiple worksheets from spreadsheet files.


Import ToolImport data from file

Live Editor Tasks

Import DataImport data from a file in the Live Editor (Since R2023a)


expand all

Basic Import and Export

readtableCreate table from file
writetableWrite table to file
readtimetableCreate timetable from file (Since R2019a)
writetimetableWrite timetable to file (Since R2019a)
sheetnamesGet sheet names from spreadsheet file (Since R2019b)

Define Import Rules

detectImportOptionsCreate import options based on file content
spreadsheetImportOptionsImport options object for Spreadsheets
getvaroptsGet variable import options
setvaroptsSet variable import options
setvartypeSet variable data types
previewPreview eight rows from file using import options
readmatrixRead matrix from file (Since R2019a)
writematrixWrite a matrix to a file (Since R2019a)
readcellCreate cell array from file (Since R2019a)
writecellWrite cell array to file (Since R2019a)
readvarsRead variables from file (Since R2019a)
importdataLoad data from file


spreadsheetDatastoreDatastore for spreadsheet files


Read Spreadsheet Data

Write Spreadsheet Data