Excel files can't hold more than 65535 rows per worksheet

Updated . Posted . Visible to the public.

"Classic" Excel (XLS) has a magic limit of 65535 rows per worksheet. This was fixed in XLSX but the version used by the Spreadsheet gem Show archive.org snapshot can only write XLS files.

If you want to write more data, consider hacking around it using in_groups_of and writing multiple column sets of your data (i.e. split 1 block of 3 columns and 100000 rows into 4 blocks of 3 (12 in total) columns and 25000 rows).

You can do this until you reach the other limit of 256 columns. After that, open up a new workbook or consider a better file type.

As an alternative, you could switch to axlsx, which supports writing XLSX files -- and does that really fast, too.

Arne Hartherz
Last edit
Keywords
gem
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2011-11-18 15:45)