Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
improved xlswrite.m

5.0 | 10 ratings Rate this file 59 Downloads (last 30 days) File Size: 6.12 KB File ID: #27236 Version: 1.0

improved xlswrite.m



Makes xlswrite use 'persistent' actxserver and hence much faster

| Watch this File

File Information

If writing or reading repeatedly to same spreadsheets very slow to keep creating and deleting the active x server. These extra 4 lines of code cause xlswrite to remember if you accessed this spreadsheet before and then not re-create the active x server.


This file inspired Despiking Acoustic Doppler Velocimeter (Adv) Data and Microscopy Image Browser (Mib).

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
07 Apr 2016 James Ang

Hi, I'm using 2015b.

I downloaded and unzipped the file, placed the 'improved' xlswrite in my current folder together with the m-file I'm working with, disabled the built-in function by removing E:\matlab\toolbox\matlab\iofun from the Matlab path.

I typed
>>which xlswrite -all
and only saw the 'improved' version shown.

I then ran the codes but from the tic toc timer the reading is about 50-ish secs, almost similar to the built-in xlswrite function, also about 50-ish secs.

Did I use the function incorrectly?

Comment only
20 May 2015 Ilya Belevich  
30 Apr 2015 Suraj Srivastava


How can I use this function in GUI?

As I have downloaded this file and kept it in my current foldeer. After that I ran the code, but the speed did'nt got improved.

Kindly help me out.


23 Feb 2015 Biagio Ciuffo

I have a model implemented in a spreadsheet and I want to check the results for different combinations of the input parameters. So I made a loop and at each step I use Matlab to write in the excel file the and afterwards to read the value of a specific cell (output of the model). Since I need to do it n thousands of time I was looking for a solution alternative to xlswrite. I tried to modification posted here but I don't see any difference in the performance. I run MATLAB R2014a on a Windows Server 2008 R2 and Excel 2010.
Any suggestion?

Comment only
05 Feb 2015 Maggie

Maggie (view profile)

I downloaded the zip file, but when I tried to run the code I get an error of not enough input arguments. How do I properly incorporate this improved xlswrite for my use?

Comment only
28 Nov 2014 meli

meli (view profile)

how can i download this file please?

Comment only
16 Sep 2014 Dave Perry

THANK-YOU x 10! - this code works much faster than the original version (on Win7 - 32b - with 2013a)

21 May 2014 Marco Marino

With just 4 lines of code my script has become 4 times faster!

Cheers man!

02 May 2013 Victor

Victor (view profile)

27 Mar 2013 Daniel

Daniel (view profile)

27 Mar 2013 Daniel

Daniel (view profile)

Oh my god, I can't thank you enough!! I am using MATLAB to locate particles in over 9,000 images and then write location data to excel. This has sped things up incredibly!

Comment only
03 Aug 2012 K E

K E (view profile)

Do I need to rename this to xlswrite1.m to distinguish it from the builtin xlswrite?

28 Nov 2011 Sebastian W

I optimized my program before I found this and only got 3 write commands left, but this new xlswrite function is roughly 10 times faster.
Thanks Barry.

31 Jul 2011 Fernando tyffing

Works very good, priori to using this it was impossible to run parfor creating a lot of xls files.

11 Nov 2010 Stan Young

Does this leave anything open in the background that would be of concern if writing a large number of spreadsheets - sort of like leaving file pointers open?

Comment only
04 Jul 2010 Milkykung

Thank you very much for your effort in going into details of ActiveX server when dealing with xls file using MATLAB.

I have to admit that I have no clue what is going when my xlswrite is running as I know superficially that ActiveX server has to be created and I simply use it. I realise your powerful correction of the xlswrite when I struggle to run 7-8 lines of xlswrite continuosly for 360 times and it kept crashing. I have been trying to run it for 2-3 days and it ends up the same way sooner or later. I have to divide it and run seperately but still a painful delay causes freezing several times.

I totally appreciate on what you have done on this and your contribution is highly regarded as a life and time-saver. I can have my program running and getting results thanks to you.

Thank you very much again and please keep it up.

Kind regards,

Contact us