Excel last_row truncated at 255

14 views
Skip to first unread message

Rob Burrowes

unread,
Dec 21, 2009, 6:09:23 PM12/21/09
to ruby-roo
I have a spreadsheet with 1536 rows. Excel::last_row says that the
last row is 255. Looks suspiciously like a single byte is being used
( or look at) for row numbers.

ex = Excel.new("test.xls")
puts ex.last_row
i = 0
(ex.first_row .. ex.last_row ).each do |r|
i += 1
print "#{i} "
(ex.first_column ... ex.last_column ).each do |c|
content = ex.cell(r,c)
print content != nil ? content : '', "\t"
end
content = ex.cell(r,ex.last_column)
print content != nil ? content : '', "\n" if(ex.last_column != nil)
end

prints 255 followed by the first 255 rows of 1536 in the file!

Thomas Preymesser

unread,
Dec 22, 2009, 5:06:44 AM12/22/09
to ruby-roo
Hello,

i cannot reproduce your problem. I have a test spreadsheet with 3735
rows and roo says, last_row is 3735.
Can you send me a sample spreadsheet file which shows your problem?

-Thomas

Rob Burrowes

unread,
Dec 22, 2009, 3:53:25 PM12/22/09
to ruby-roo
I will recreate one that doesn't have sensitive information in it and
forward it directly to you.

I am running Mac OS X 10.6.2. I wonder if this is something to do with
the 64 bit libraries.

I also tried just referencing rows beyond 255 and got empty rows too.

Rob Burrowes

unread,
Dec 22, 2009, 4:21:06 PM12/22/09
to ruby-roo

Looks like it is actually something about the file. It was produced by
our HR system and opens fine in Excel (Mac or PC), but has the 255 row
problem with roo.

If I save it in Excel, roo works fine with the saved version. Excel
must recognise a slightly different format and change it on saving the
file. That means I can't modify it to remove the staff names etc.

I also can't email to the above address. tho...@gmail. It get bounced
by gmail. Is there somewhere I could send the original file?

On Dec 22, 11:06 pm, Thomas Preymesser <tho...@gmail.com> wrote:

Rob Burrowes

unread,
Dec 22, 2009, 4:43:18 PM12/22/09
to ruby-roo
Neo Office can also read all the rows and also makes a change on
saving, so that roo then reads beyond row 255.
Reply all
Reply to author
Forward
0 new messages