Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Spreadsheets

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 import options for spreadsheet files, see Ways to Import Spreadsheets.

Functions

readtable Create table from file
detectImportOptions Create import options based on file content
writetable Write table to file
xlsfinfo Determine if file contains Microsoft Excel spreadsheet
xlsread Read Microsoft Excel spreadsheet file
xlswrite Write Microsoft Excel spreadsheet file
importdata Load data from file

Using Objects

SpreadsheetImportOptions Import options object for Spreadsheets

Examples and How To

Select Spreadsheet Data Using Import Tool

This example shows how to import data from a spreadsheet into the workspace with the Import Tool.

Import a Worksheet or Range

This example shows how to import mixed numeric and text data from a spreadsheet into a table, using the readtable function.

Import All Worksheets from a File

This example shows how to import worksheets in an Excel file that contains only numeric data (no row or column headers, and no inner cells with text) into a structure array, using the importdata function.

Import and Export Dates to Excel Files

Microsoft Excel software can represent dates as text or numeric values.

Export to Excel Spreadsheets

This example shows how to export a numeric array and a cell array to a Microsoft Excel spreadsheet file, using the xlswrite function.

Import or Export a Sequence of Files

To import or export multiple files, create a control loop to process one file at a time.

Define Import Options for Tables

Typically, you can import tables using the readtable function.

Concepts

Ways to Import Spreadsheets

You can import data from spreadsheet files into MATLAB® interactively, using the Import Tool, or programmatically, using an import function.

System Requirements for Importing Spreadsheets

If your system has Excel for Windows® installed, including the COM server (part of the typical installation of Excel):

Was this topic helpful?