Re: [pyxl] Wrong sheet.nrows

108 views
Skip to first unread message

John Yeung

unread,
Oct 11, 2012, 9:53:02 PM10/11/12
to python...@googlegroups.com
Can you provide an example Excel file (without sensitive or
copyrighted information) that exhibits this behavior, so that we can
try it out for ourselves?

Also, what operating system are you using? Python 2.3.7 is very, very
old. Is there any chance you can install something newer?

John Y.

John Machin

unread,
Oct 12, 2012, 5:55:34 PM10/12/12
to python-excel
> I am having a problem with sheet.nrows showing a smaller number than actual
> rows in Excel 2010 file.

> for example, nrows=822 but actual rows=851. nrows=910, actual rows=1079.

> I am using Python 2.3.7 and latest xlrd.

In your 822 actual but 851 expected example, where are the 29 rows
missing from: start of sheet? end of sheet? a contiguous block
elsewhere? seemingly at random? What are the contents of the missing
rows?

If the missing rows are all at the end of the sheet AND the cells in
those rows have formatting only (i.e. no data content) AND you are
operating with formatting_info=False (which is currently the only
possibility with Excel 2007+ files), then the observed result is to be
expected ... nrows = 1 + (highest row index of any data cell seen).
Similarly with ncols.

Otherwise, it looks like a bug somewhere; please provide a sample
file.

About Python 2.3: To be able to read Excel 2007+ files, you will have
needed to install an ElementTree implementation (not supplied with
Python 2.3). What did you install?
Reply all
Reply to author
Forward
0 new messages