|Problems? Is your data what you think it is?|
Re: Spreadsheet::WriteExcel large filesby jmcnamara (Monsignor)
|on Jan 02, 2012 at 17:54 UTC||Need Help??|
The most likely explanation for the size difference is the file format after the file has been saved is. Is the 6 MB file in xls or xlsx format?
Excel's xls binary BIFF format doesn't use compression. However, it does use some space optimizations which Spreadsheet::WriteExcel doesn't include so in general a file re-saved in xls format by Excel may be 10-20% smaller, depending on the data it contains and the arrangement of the data.
Excel's xlsx format is compressed XML data so it can be significantly smaller than the equivalent xls file even if both are created by Excel.
If you would like to generate files in the xlsx format try Excel::Writer::XLSX. It is API compatible with Spreadsheet::WriteExcel so you should be able to just change the module names and re-run your program. If you do, let us know what the xlsx output file size is.
Here is some sample data based on the output of the bigfile.pl example program:
Results for other files may vary significantly depending on the ratio of string/number data and some other factors.