Microsoft® Excel® spreadsheets

Read and write data in spreadsheet files, including .xls and .xlsx files. Import spreadsheet data interactively using the Import Tool. Import or export spreadsheet data programmatically using the functions on this page. To compare primary ways to import spreadsheet files, see Ways to Import Spreadsheets.


expand all

Import ToolImport data from file

Basic Import and Export

readtableCreate table from file
writetableWrite table to file
readtimetableCreate timetable from file
writetimetableWrite timetable to file

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
writematrixWrite a matrix to a file
readcellRead cell array from file
writecellWrite cell array to file
readvarsRead variables from file
xlsfinfoDetermine if file contains Microsoft Excel spreadsheet
importdataLoad data from file


spreadsheetDatastoreDatastore for spreadsheet files


Ways to Import Spreadsheets

You can import data from spreadsheet files into MATLAB® interactively using the Import Tool, programmatically using import functions, or by pasting data from the clipboard.

Write Data to Excel Spreadsheets

Export data in the workspace to a Microsoft Excel spreadsheet file.

Define Import Options for Tables

For customized data import and additional control over the import process, define and use the import options.