File Exchange

image thumbnail


version (2.39 KB) by Andreas Sprenger
Write matrices to MS Excel file.


Updated 13 Feb 2006

No License

This function writes one or more matrices to one or more Excel sheets. Columnnames and header or sheetnames are possible. It is only the extension of Scott Hirsch's xlswrite.m provided earlier.
It should be possible to adapt to OpenOffice. If somebody helps me with ActiveX for OpenOffice...

Cite As

Andreas Sprenger (2021). xlswrite (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

John Booker

arun sharma

It was very helpful and i found other submitted program producing error but this one was absolutely perfect in my case.

Jens Benecke

Using parseXML from the "xmlread" documentation in MATLAB to read the "content.xml" that is inside an OpenOffice spreadsheet document (.ods == .zip!) is slow, but it works, and without resorting to platform-specific hacks like ActiveX. Now someone just needs to convert this "tree" structure (XML) into a matrix! I would be willing to help out here, but I would need some help.

ken stessens

I am frequently using this function for filling excel documents. I was wondering if there have been further attemps for making it work in the OpenOffice environment.
Unfortunately, I don't have any activeX programming skills myself...

thanks in advance!

Mark Hayworth

Good but needs improvement. Needs option to leave spreadsheet open, minimized, and visible even if they do give it a name, in case the user wants to check out the data they just poked. Also need argument to specify upper left cell of matrix - I don't always want data at cell A1 especially if I'm adding data to an existing spreadsheet (which this can't do anyway). Also need option to add to existing spreadsheet rather replace it. If file exists, and you say no to replacing it, it gives an error (and leaves Excel server running invisibly with Book1 open which gives strange behaviour the next time you use Excel) rather than exiting gracefully. One comment is wrong:
% %header{1} = 'first line'; %This will give
% %header{2} = 'second line'; % 2 header lines
is wrong and will give errors.
Correct sample code is below - this works.
header = {'first line' 'second line'};

Juan Carlos Morataya

The OpenOffice implementation becomes the program very useful, no doubt on that, I am currently working in this issue, any help will be appreciated

kaan kandemir

the problem of Scott Hirsch's file is that if ur not using english version of excel u ll have 'sheet1 does not exist' message due to the language... but with ur version it works verywell as far as i can see..

Gábor Jakab

I agree Mr. Garofalo, too. If openoffice is not implemented, it woluld be a great help even to have some description on aquiring ProgIDs.

Eric Frederick

I agree with the previous comment. The ablility to write with OpenOffice would be a great enhancement to this program especially for Linux users (or for people who just avoid MS). If someone could post a workaround for this problem, it would be greatly appreciated.

Pietro Garofalo

Every code which calls this routine imposes to have Ms Excel installed and I cannot impose to everyone to buy Matlab and also Excel.
Exporting to openoffice format would be wonderful!
Is there a way in which to use the same format of excel but calling openoffice for the creation?
I must write something like "openoffice.Application" ? Thanks.

vinicius kuser

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!