Main Content

Spreadsheets

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.

Apps

Import ToolImport data from file

Live Editor Tasks

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

Functions

expand all

Basic Import and Export

readtableCreate table from file
writetableWrite table to file
readtimetableCreate timetable from file
writetimetableWrite timetable to file
sheetnamesGet sheet names from spreadsheet 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
readcellCreate cell array from file
writecellWrite cell array to file
readvarsRead variables from file
importdataLoad data from file

Objects

spreadsheetDatastoreDatastore for spreadsheet files

Topics

Read Spreadsheet Data

Write Spreadsheet Data