spreadsheet icon indicating copy to clipboard operation
spreadsheet copied to clipboard

Create an excel file with more than 256 columns

Open sokmesakhiev opened this issue 2 years ago • 5 comments

I am having trouble creating an excel file with 355 columns. I opened it via Microsoft excel and there is a message warning me that the file is corrupt but it allowed me to view it. Inside the file, there are only 256 columns created and the other 95 columns are missing.

Screen Shot 2022-04-01 at 1 56 35 PM Screen Shot 2022-04-01 at 1 56 48 PM Screen Shot 2022-04-01 at 1 57 06 PM Screen Shot 2022-04-01 at 1 57 17 PM

sokmesakhiev avatar Apr 01 '22 06:04 sokmesakhiev

  1. Which office version?
  2. Which OS?
  3. Download Libreoffice, open the file with Libreoffice, save the file and try again.
  4. Which software created the original XLS file?

zdavatz avatar Apr 01 '22 15:04 zdavatz

XLS file format has a hard limit of 256 columns (A = 0 ... IV = 255) but the library does not enforce the constraint. In light of common row limit errors like https://www.bbc.co.uk/news/technology-54423988 , the best fix is to truncate with warning or error when trying to write beyond the limits.

The file can still be repaired because the col field of the Cell structure is 2 bytes wide. The file can technically support up to XFD (column 65535) but the Excel parser will fail.

reviewher avatar Apr 05 '22 01:04 reviewher

  1. Which office version?
  2. Which OS?
  3. Download Libreoffice, open the file with Libreoffice, save the file and try again.
  4. Which software created the original XLS file?

I use Microsoft Office on latest Mac OS. I don't try with LibreOffice yet but I use gem to create xls file.

sokmesakhiev avatar Apr 05 '22 09:04 sokmesakhiev

XLS file format has a hard limit of 256 columns (A = 0 ... IV = 255) but the library does not enforce the constraint. In light of common row limit errors like https://www.bbc.co.uk/news/technology-54423988 , the best fix is to truncate with warning or error when trying to write beyond the limits.

The file can still be repaired because the col field of the Cell structure is 2 bytes wide. The file can technically support up to XFD (column 65535) but the Excel parser will fail.

Yes, I feel it is the limitation of XLS.

sokmesakhiev avatar Apr 05 '22 09:04 sokmesakhiev

I use Microsoft Office on latest Mac OS. I don't try with LibreOffice yet but I use gem to create xls file.

Please give it a try wit LibreOffice.

zdavatz avatar Apr 05 '22 09:04 zdavatz