Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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:

bigfile1.xls 10,379,264 # Original from Spreadsheet::WriteExcel. + 100% bigfile2.xls 10,525,184 # Resaved by Excel in xls format. + 102% bigfile3.xlsx 2,733,546 # Resaved by Excel in xlsx format. + 27% bigfile4.xlsx 2,325,559 # Original from Excel::Writer::XLSX. + 23% bigfile5.zip 1,888,573 # bigfile1.xls zipped for comparison. + 18%

Results for other files may vary significantly depending on the ratio of string/number data and some other factors.

--
John.


In reply to Re: Spreadsheet::WriteExcel large files by jmcnamara
in thread Spreadsheet::WriteExcel large files by mrguy123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-03-29 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found