There is any way to know the dimensions of an excel file (rows, columns) without using xlsread?

조회 수: 17 (최근 30일)
There is any way to know the dimensions of an excel file (rows, columns) without using xlsread?
I have very large .csv/.xlsx files and I want to increase a waitbar. My strategy will be make a loop with a percentage of the file to read and then increase the waitbar.... repeating it till the file is completely read.

답변 (2개)

Tom
Tom 2013년 6월 19일
You can, but you have to open an Actx server - I wouldn't bother unless you really think it's worth it...
Excel = actxserver('excel.application');
Excel.workbooks.Open(fileName,0,true); %file name must also have path
nCols = Excel.ActiveSheet.UsedRange.Columns.Count;
nRows = Excel.ActiveSheet.UsedRange.Rows.Count;
Excel.Quit
Excel.delete
That will probably need adding to (e.g. specifying a worksheet)

David Sanchez
David Sanchez 2013년 6월 19일
NO, there is not a way to do what you need/want.

카테고리

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