Microsoft® Excel® spreadsheets
Read and write data in spreadsheet files, including
.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 Tool||Import data from file|
Live Editor Tasks
|Import Data||Import data from a file in the Live Editor|
Read and Write Tables or Timetables
Basic Import and Export
|Create table from file|
|Write table to file|
|Create timetable from file|
|Write timetable to file|
|Get sheet names from spreadsheet file|
Define Import Rules
|Create import options based on file content|
|Import options object for Spreadsheets|
|Get variable import options|
|Set variable import options|
|Set variable data types|
|Preview eight rows from file using import options|
Read and Write Matrices and Arrays
|Read matrix from file|
|Write a matrix to a file|
|Create cell array from file|
|Write cell array to file|
|Read variables from file|
|Load data from file|
|Datastore for spreadsheet files|
Read Spreadsheet Data
- Import Spreadsheets
Spreadsheets often contain a mix of numeric and text data as well as variable and row names, which is best represented in MATLAB as a table.
- Read Spreadsheet Data Using Import Tool
Preview spreadsheet data from a file or the clipboard and select data to import using the Import tool.
- Read Spreadsheet Data into Table
The best way to represent tabular spreadsheet data in MATLAB is in a table since tables can store heterogeneous (a mix of numeric and text) data, as well as variable and row names.
- Read Spreadsheet Data into Array or Individual Variables
In addition to importing data as a table using
readtable, you can also import data as a matrix, a cell array, or import separate variables directly in to the workspace.
- Read Collection or Sequence of Spreadsheet Files
Read and manage data from a collection of spreadsheet files.
- Define Import Options for Tables
If you want to control the import process beyond the options provided by the
readtablefunction, such as defining how to handle missing data or errors, then create an import options object before importing the data.
Write Spreadsheet Data
- Write Data to Excel Spreadsheets
Export data in the workspace to a Microsoft Excel spreadsheet file.