Need name of particular 'nth' sheets

조회 수: 3 (최근 30일)
Ghenji
Ghenji 2017년 11월 3일
편집: KL 2017년 11월 3일
I would like to get names of only highlighted sheets. There are about 50 excel files I will load these files together using pushbutton and parallely I want these only 4 sheetnames (with sheet no. 10,12,13,14 respectively) in listboxdata. All the excel files have same format so position of sheets are fixed.

채택된 답변

KL
KL 2017년 11월 3일
편집: KL 2017년 11월 3일
use xlsinfo,
[status,sheets] = xlsfinfo(filename)
then sheets is a cell array with all the sheet names in your file. Since you already know the indices, you can get them by,
wanted_sheets = sheets(1,[10,12,13,14])
  댓글 수: 4
Ghenji
Ghenji 2017년 11월 3일
just want to get these 4 sheetnames from all the excel files. I will be handling data from these sheets further.
KL
KL 2017년 11월 3일
편집: KL 2017년 11월 3일
Alright. Do you have all these files in the same folder? if so you don't have to use uigetfile,
folderInfo = dir('foldername\*xls'); %assuming only the files you want exist
filenames = {folderInfo.name};
sheets = cell(size(filenames));
for k=1:numel(filenames)
[~,sheets{k}] = xlsfinfo(filename{k});
end

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by