how to read the Sheet name present in any Excel file ?

66 ビュー (過去 30 日間)
Ajay Pherwani
Ajay Pherwani 2013 年 2 月 6 日
コメント済み: Walter Roberson 2023 年 8 月 8 日
I am working on a script , that will read the data present in an excel file. The sheet is an standard template one . There are many Sheets present in a excel file (and will vary depending upon the various products that we have ... and i am trying to make a general script that will work over all excel files).
Is there any way to find out the names of the sheets in the excel file ?
I have tried 'xlsread' , but that didn't help much
is there any command that will help me fetch the total number of sheets and their names ?
Regards, Ajay

採用された回答

owr
owr 2013 年 2 月 6 日
"xlsfinfo" will get you a list of sheet names.
  2 件のコメント
Ajay Pherwani
Ajay Pherwani 2013 年 2 月 10 日
hey Thanks !!
Remy Lassalle-Balier
Remy Lassalle-Balier 2020 年 8 月 19 日
It seems it is now changed to sheetnames.

サインインしてコメントする。

その他の回答 (2 件)

Pruthvi G
Pruthvi G 2020 年 4 月 13 日
%%********************************************************************************
% 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'}
  3 件のコメント
wenchao zhang
wenchao zhang 2023 年 8 月 8 日
[STATUS,SHEETS,FORMAT] = xlsfinfo('D:\MatlabWorkSpace\read_the_Sheet_name\data.xlsx');
Walter Roberson
Walter Roberson 2023 年 8 月 8 日
Or, as @Remy Lassalle-Balier pointed out, these days sheetnames is recommended.

サインインしてコメントする。


Kaiser Ahmed Bhuiyan
Kaiser Ahmed Bhuiyan 2020 年 10 月 1 日
編集済み: Kaiser Ahmed Bhuiyan 2020 年 10 月 1 日
The perfect command is : I tried other command mentioned above ..doesn't work anymore.
[status,sheets] = xlsfinfo(filename)
filename should be written within ' ' (single apostrophe)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by