필터 지우기
필터 지우기

How to check existence of worksheet in excel file

조회 수: 42 (최근 30일)
YoungKwang
YoungKwang 2012년 1월 11일
댓글: Ilya Gurin 2021년 8월 13일
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?

채택된 답변

C.J. Harris
C.J. Harris 2012년 1월 11일
[A,B] = xlsfinfo('foofoo.xlsx');
sheetValid = any(strcmp(B, 'foo2'));
  댓글 수: 2
YoungKwang
YoungKwang 2012년 1월 12일
Oh. Appreciate your answer so much. It did work. !!
Ilya Gurin
Ilya Gurin 2021년 8월 13일
Matlab help now says, "xlsfinfo is not recommended. Use sheetnames instead."

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Doug Hull
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
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.
YoungKwang
YoungKwang 2012년 1월 12일
I got it solved with Chris's way. But thanks for your answer as well.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by