Writecell/table to Excel error
40 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
dpb
about 5 hours ago
Moved: dpb
about 2 hours ago
Which OS and show a sample code that fails...
tX=array2table(randn(4,3),'VariableNames',cellstr(('A':'C').'))
writetable(tX,'test.xlsx')
dir
clear tX
readtable('test.xlsx')
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.
3 Comments
dpb
about 4 hours ago
Moved: dpb
25 minutes ago
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>
Fangjun Jiang
about 2 hours ago
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!