How to check existence of worksheet in excel file
47 次查看(过去 30 天)
显示 更早的评论
I'm working on some script and i need to check if there's any particular name of worksheet. Is there anyway to check the workshee existing in excel file? Additionally, I wanna know if there is the way deleting particular worksheet. And I don't wanna use activeX for this. Can anybody help me?
0 个评论
采纳的回答
更多回答(1 个)
Doug Hull
2012-1-11
>> [a,b] = xlsread('foofoo.xlsx','foo2')
Error using xlsread>activate_sheet (line 435)
Specified worksheet was not found.
Error in xlsread (line 259)
activate_sheet(Excel,sheet);
Throw a Try Catch around it.
3 个评论
Doug Hull
2012-1-11
I like Chris' answer better about xlsinfo. Mine will error for the wrong sheet and then you can TRY CATCH the error.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!