Need name of particular 'nth' sheets
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
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.

0 个评论
采纳的回答
  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 个评论
  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 Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

