A function which exports a given Matlab array / Cell array to an Excel Spreadsheet.


Updated 21 Jun 2009

View License

EXPORT2EXCEL function exports a Matlab array / Cell array to Excel spreadsheet.

Microsoft Excel activex server i.e Excel Com object is used to export data from Matlab to Excel.Hence Microsoft Excel is a must to have for exporting data from this function.

This Function also changes the Cell Properties.Color of each Cell containing data in the spreadsheet will be Yellow. Excel has 56 Color Index Values to Choose from.

Use conditional formatting for changing Cell color depending on its Value.

An Excel sheet containing the 56 colors and corresponding color indicies is included in this package(Colors.xls file).

The Maximum number of Columns supported by this release is 702 for Excel 2007 and 256 for Excel 2003.

A Matlab array / Cell array with columns greater than the above mentioned limits is not supported.

Error messages corresponding to invalid input and array exceeding Columns are thrown on to Matlab Command Prompt.

Versionflag determines the version of Excel, this is needed because Excel 2003 can import only 256 columns (i.e from 'A' to 'IV') of data and Excel 2007 allows a large number of columns to be imported, but in this program no of columns for Excel 2007 are restricted 702 (i.e from 'A' to 'ZZ')

E.g. 1) Flag = Export2Excel(ones(100,100),'A4');
default version flag 0 i.e Excel 2003 is assumed to be
present on the system
2) x = [1 2 3 4];
Flag = Export2Excel(x,'B4',1);
version flag 1 specified i.e Excel 2007 is assumed to be present on the system.

Cite As

Shameemraj Nadaf (2023). Export2Excel (https://www.mathworks.com/matlabcentral/fileexchange/24503-export2excel), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes