obtain information on excel files

6 ビュー (過去 30 日間)
Richard
Richard 2012 年 1 月 10 日
編集済み: Walter Roberson 2019 年 7 月 28 日
Is there a method for obtaining more information for excel files? I can use
[status,sheets,format] = xlsfinfo(filename)
to find the names of each sheet in the workbook, however, I'm trying to find a way of obtaining the number of measurements i.e. the number of rows and columns in the excel files. Is there a way of doing this without having to import the data into matlab?

採用された回答

Titus Edelhofer
Titus Edelhofer 2012 年 1 月 10 日
You could open the file using actxserver (see doc) and make your way through the file using methods and properties. It probably will be cumbersome, though.
  2 件のコメント
Richard
Richard 2012 年 1 月 10 日
I have used actxserver before but it takes too long to process the excel files (75+ files) therefore was hoping to aviod using it.
Titus Edelhofer
Titus Edelhofer 2012 年 1 月 10 日
But you could still save some time: if you take a look at xlsfinfo, you see, that it starts Excel as activeX server as well. Most of the time is spent for two lines, namely starting the server and opening/closing a file. You could save the first by looping over all files without stopping the activex server. I guess not much else can be done ...

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

その他の回答 (1 件)

Sukuchha
Sukuchha 2012 年 1 月 13 日
編集済み: Walter Roberson 2019 年 7 月 28 日
I guess if you know VBA then you can use to get what u want after opening with activeX server. for example below, sheets and counts are funtion of excel.
excelObj = actxserver('Excel.Application');
excelWorkbook = excelObj.workbooks.Open('Book2.xls');
worksheets = excelObj.sheets;
numSheets = worksheets.Count;

カテゴリ

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