How to get the name of a specified excel sheet?
8 次查看(过去 30 天)
显示 更早的评论
Hello, Is there any way I could get the name of of a specified excel sheet? For example, sheet=2; When I use xlsfinfo, sheet names will be displayed but not in the order of occurrence in an excel file. I appreciate your help.
Thank you
6 个评论
Guillaume
2018-5-6
So, what output do you get? And which version of matlab and which version of excel?
Note that matlab simply asks excel for the list of worksheets, so whatever order you get is the one returned by excel.
回答(1 个)
Pruthvi G
2020-4-13
Download Link :: https://in.mathworks.com/matlabcentral/fileexchange/74993-get-sheet-names-from-excel-file
%%********************************************************************************
% Name : xl_xlsfinfo
% Author : Pruthvi Raj G
% Version : Version 1.0 - 2011b Compactible
% Description : Finds all the sheets in the Excel file (.xls,.xlsm,.xlsx)
% Input : File_Name with path included.
% Date : 11-Feb-2020
%
% Examples : xl_xlsfinfo('D:\Pruthvi\Test_file.xls')
%*********************************************************************************
Use the Below Lines of Code ::
sheets = xl_xlsfinfo('D:\Pruthvi\Test_file.xls')
sheets =
1×5 cell array
{'Sheet1'} {'Sheet2'} {'Sheet3'} {'Sample'} {'Data'}
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!