> "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Anand wrote: >> >> >>>Greetings, >>> >>>How can I find the number of active columns and rows used in an excel > > work > >>>sheet? >>>What I mean is how can i find the last column and row or cell position, >>>where the data is stored in an excel sheet? >> >>Is the worksheet currently open in Excel or OpenOffice, >>and you wish to query the application for that information? >> >>Or do you want to read the spreadsheet in from a file? >> Anand wrote [at the top of the post, which was naughty]: > Greetings, > > The worksheet is currently opened in Excel. > And I want to read the data from the excel worksheet. > Instead of looping through the entire worksheet, I want to limit the looping > to the rows and columns used so far!
An observation: if I record a macro and then use CTRL/End to go to the "bottom right-hand corner" of the spread, I see that Excel records: ActiveCell.SpecialCells(xlLastCell).Select It's then just a matter of finding out the row and column number of the currently-selected cell (or of xlLastCell if you don't want to change locations). regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list