Performance: readTable versus xlsread
Show older comments
Dear Community,
I am reading the contents of an Excel Workbook (.xlsx) file. It's a pretty large, but not crazy file (approximately 26k rows-by-24 columns; 3MB). The data is a mixture of a text header (row 1) and the rest is a mixture of numbers and strings.
Until now, I've been using xlsread to process this file. According to the MATLAB documentation, xlsread is not recommended and I should consider readtable or readcell instead:
"The readtable, readmatrix, and readcell functions have these advantages over the xlsread function: Better cross-platform support and performance..."
In MATLAB 2019a for my Excel file, xlsread takes about 1.2 seconds to get the output; readtable takes about 12 seconds; readcell takes about 42 seconds.
It appears to me that xlsread is superior to the other two methods when it comes to speed. Hence my question: What is meant in the documentation by "Better cross-platform support and performance"? What is this performance measured relative to? I appreciate that readtable and readcell have various other advantages, so I understand their use cases. I'm wondering if there's anything obvious that I'm missing which could improve the performance?
I'm calling the methods in a very simple fashion:
[~, ~, csvData] = xlsread(filename);
csvData = readtable(filename);
csvData = readcell(filename);
Thanks,
Louis
2 Comments
Jeremy Hughes
on 7 Jul 2022
Interested if you've tried this is a recent MATLAB release. Or if you have a file that is running slowly, attach it. Then someone might be able to provide a better answer.
Daniel Pereira
on 17 Jul 2026 at 8:28
I've been experiencing something similar.
I've noticed that when doing just one call to a file, xlsread is typically (not always) faster than any of the new options (readmatrix,readcell, readtable), at least in Windows.
However, if you want to write and read from the same file, the new options are much faster: It seems it does not need to open and close the xls* file every time you call the read/write function, but it keeps it open.
In the past, we dealt with that issue with OpenExcel, xlsread2, xlwrite2, CloseExcel that used to exist in file exchange.
I still keep a copy of those, which I've been improving along the years. Let me know if you are still interested or if you found a clear solution to this issue.
Answers (1)
Abdolkarim Mohammadi
on 28 Mar 2021
Edited: Abdolkarim Mohammadi
on 28 Mar 2021
0 votes
I don't know about the exact thing you mentioned, but I have experienced that when reading many matrixes from Excel (hence many calls to xlsread() or readmatrix()), the file with readmatrix() runs significantly faster than the same file but with xlsread().
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!