in reply to Spreadsheet::WriteExcel::Big is Bigger


Excel uses several optimisations to reduce the size of it's files. One is to store 64bit floats in 32bits if possible.* Spreadsheet::WriteExcel trades this space for speed (and simplicity) and writes all numbers as 64 bit floats.

Excel also stores repeated strings in a hash table. This can give a big space saving for certain types of data. Spreadsheet::WriteExcel will do this in a later version but probably only for long strings.

There are a few other optimisation as well. When you save the file, Excel will perform the optimisations and the file size will reduce.

Note, you can write an array of data in one go by passing it as an arrayref:

# print information to Excel spreadsheet $worksheet->write($row, 0, \@XLSarray); $row++;

--
John.

* For the anoraks. Actually, where possible, it stores ints and floats in 30 bits and uses the other two bits to indicate the type of stored variable.

Replies are listed 'Best First'.
(shockme) Re: Re: Spreadsheet::WriteExcel::Big is Bigger
by shockme (Chaplain) on Jan 23, 2002 at 22:37 UTC
    Thanks John. Opening it with Excel and saving it did reduce the size of the file.
    • WriteExcel: 6.85MB
    • Comma delimited: 6.24MB
    Cool stuff! Thanks again.

    If things get any worse, I'll have to ask you to stop helping me.