readtable successful on .xlsx file but fails on .xlsb file

12 views (last 30 days)
readtable works fine reading an .xlsx file, but hangs when reading an .xlsb file.
The following works perfectly:
dat = "C:\DataDirectory\DataFile.xlsx";
T = readtable(dat);
I read in the documentation for readtable that for large Excle files reading the .xlsb format is recommended, so I saved the Excel file in .xlsb format and I tried:
dat = "C:\DataDirectory\DataFile.xlsb";
T = readtable(dat);
but this opens the Excel file and then freezes both Excel and Matlab. The only way to recover was to end the Excel process via TaskManager.
Matlab version is 2019b.
Excel version: Microsoft® Excel® for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20374) 32-bit
I can continue to work with the .xlsx format, but I'm still curious if I'm doing something wrong, or if there is a known issue. It would be nice to use the .xlsb format if it in fact loads faster.

Answers (1)

Cris LaPierre
Cris LaPierre on 4 May 2023
Edited: Cris LaPierre on 4 May 2023
No, you are not doing anything wrong. *.xlsb files are officially supported in readtable in R2019b.
readtable determines the file format from the file extension:
  • .txt, .dat, or .csv for delimited text files
  • .xls, .xlsb, .xlsm, .xlsx, .xltm, .xltx, or .ods for spreadsheet files
How were your xlsb files created? Can you attach one to your post for others to test?
You might consider adding the 'UseExcel' flag.
dat = "C:\DataDirectory\DataFile.xlsb";
T = readtable(dat,'UseExcel',true);
  3 Comments
Cris LaPierre
Cris LaPierre on 4 May 2023
If your information is confidential, then I suggest working directly with support. You can reach out to them here: https://www.mathworks.com/support/contact_us.html

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!