Writecell/table to Excel error

Hi all,
I can no longer export data to Excel using writecell/table, because the function crashes due to an import issue :
Error using writetable (line 278)
Error: File: createWorkbook.m Line: 80 Column: 12
Unable to find or import 'matlab.io.spreadsheet.internal.BookType'.Imported names must end with '.*' or be fully qualified.
No problem in Matlab R2023, as it does not seem to use the same sub-functions.
Regards,
Stéphane.

 Respuesta aceptada

StephAud
StephAud el 11 de Feb. de 2026 a las 7:59

0 votos

Here is the solution from the support team, which works for me.
rehash toolboxcache
Thank you, everyone.

Más respuestas (2)

dpb
dpb el 10 de Feb. de 2026 a las 16:06
Movida: dpb el 10 de Feb. de 2026 a las 18:43
Which OS and show a sample code that fails...
tX=array2table(randn(4,3),'VariableNames',cellstr(('A':'C').'))
tX = 4×3 table
A B C _________ ________ ________ 0.07657 0.50694 -0.54845 0.99138 1.1488 0.075866 1.9897 0.99226 -1.0944 -0.074665 -0.33147 0.67604
writetable(tX,'test.xlsx')
dir
. .. test.xlsx
clear tX
readtable('test.xlsx')
ans = 4×3 table
A B C _________ ________ ________ 0.07657 0.50694 -0.54845 0.99138 1.1488 0.075866 1.9897 0.99226 -1.0944 -0.074665 -0.33147 0.67604
It functions here, of course Excel isn't available on this platform so doesn't quite match what would happen on on Windows system with Office installed.
The specific syntax complained about by the error message exists in all prior versions so something's amiss in that.

7 comentarios

StephAud
StephAud el 10 de Feb. de 2026 a las 16:28
Movida: dpb el 10 de Feb. de 2026 a las 18:45
Thanks for your reply.
I’m currently running W11 with Office.
Here is the result I obtained with your example:
tX=array2table(randn(4,3),'VariableNames',cellstr(('A':'C').'));
writetable(tX,'test.xlsx')
Error using writetable (line 278)
Unable to find or import 'matlab.io.spreadsheet.internal.BookType'. Imported names must end with '.*' or be fully qualified.
dpb
dpb el 10 de Feb. de 2026 a las 16:44
Movida: dpb el 10 de Feb. de 2026 a las 20:18
Strange, indeed. Have you checked for and installed any updates to the MATLAB release you're running?
You can try
restoredefaultpath
rehash
at the command line and see if that helps any.
Just to be sure that haven't inadvertently aliased the writetable function, use
which -all writetable
and make sure not an alias in your local folder(s) confusing things.
If that were to be the case, then
clear writetable
will solve it.
BTW, that the same thing shows up with writecell is owing to the fact that all the various writeXXX end up internally converting the input data to a table and calling writetable behind the scenes.
If those don't solve the problem, while somewhat painful after restart/reboot then about the only thing left you can do as the end user would be to try a reinstall.
If those options don't help submit this to Mathworks as an official support request/bug at <Product Support Page>
StephAud
StephAud el 10 de Feb. de 2026 a las 17:56
Movida: dpb el 10 de Feb. de 2026 a las 18:45
I have the last update of R2025b . I tried your recommendations, but they had no effect.
restoredefaultpath
rehash
clear writetable
which -all writetable.m
C:\Program Files\MATLAB\R2025b\toolbox\matlab\io\tabular\iofun\writetable.m
C:\Program Files\MATLAB\R2025b\toolbox\matlab\bigdata\@tall\writetable.m % tall method
C:\Program Files\MATLAB\R2025b\toolbox\parallel\array\distributed\@codistributed\writetable.m % codistributed method
writetable(tX,'test.xlsx')
Error using writetable (line 278)
Error: File: createWorkbook.m Line: 80 Column: 12
Unable to find or import 'matlab.io.spreadsheet.internal.BookType'. Imported names must end with '.*' or be fully qualified.
I think I'll contact support. Thank you for your help.
Walter Roberson
Walter Roberson el 11 de Feb. de 2026 a las 3:51
Using R2025b, I am unable to find any reference to matlab.io.spreadsheet.internal.BookType anywhere in the source. Not even any reference to BookType (in case the reference got broken up somehow.) One of the libraries contains a symbol reference that includes BookType, but it turns out to be _spreadsheet_mli::get_book(spreadsheet_mli::MCOSBookType*)
Image Analyst
Image Analyst el 11 de Feb. de 2026 a las 5:18
See if you have this file: "C:\Program Files\MATLAB\R2025b\toolbox\shared\spreadsheet\+matlab\+io\+spreadsheet\+internal\BookType.m"
Walter Roberson
Walter Roberson el 11 de Feb. de 2026 a las 5:29
Editada: Walter Roberson el 11 de Feb. de 2026 a las 5:30
No, I have /Applications/MATLAB_R2025b.app/toolbox/shared/spreadsheet/+matlab/+io/+spreadsheet/+internal but that has
Book.m getSheetNames.m
columnLetter.m readSpreadsheetFile.m
columnNumber.m selectOAuthTypeId.m
createDatetime.m Sheet.m
createGoogleSpreadsheet.m SheetType.m
createWorkbook.m SheetTypeFactory.m
dateFormats.m stringize.m
getExtension.m usedDataRange.m
getRemoteSpreadsheet.m
with no BookType.
Furthermore, when I grep through all of the binary libraries and all of the .xml and all of the source code, then only BookType is a mangled C++ symbol for _spreadsheet_mli::get_book(spreadsheet_mli::MCOSBookType*) -- so I cannot even find any reference to BookType anywhere.
StephAud
StephAud el 11 de Feb. de 2026 a las 7:25
I have BookType.m
dir('C:\Program Files\MATLAB\R2025b\toolbox\shared\spreadsheet\+matlab\+io\+spreadsheet\+internal\')
. SheetTypeFactory.m dateFormats.m stringize.m
.. columnLetter.m getExtension.m usedDataRange.m
Book.m columnNumber.m getRemoteSpreadsheet.m
BookType.m createDatetime.m getSheetNames.m
Sheet.m createGoogleSpreadsheet.m readSpreadsheetFile.m
SheetType.m createWorkbook.m selectOAuthTypeId.m

Iniciar sesión para comentar.

Fangjun Jiang
Fangjun Jiang el 10 de Feb. de 2026 a las 16:37
You might have a different writetable.m
>> which -all writetable.m
C:\Program Files\MATLAB\R2025b\toolbox\matlab\io\tabular\iofun\writetable.m
C:\Program Files\MATLAB\R2025b\toolbox\matlab\bigdata\@tall\writetable.m % tall method
C:\Program Files\MATLAB\R2025b\toolbox\parallel\array\distributed\@codistributed\writetable.m % codistributed method

Categorías

Productos

Versión

R2025b

Preguntada:

el 10 de Feb. de 2026 a las 9:14

Respondida:

el 11 de Feb. de 2026 a las 7:59

Community Treasure Hunt

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

Start Hunting!

Translated by