I have been using this module in the past and I haven't noticed it.
I think you should use the Spreadsheet::WriteExcel::Big for files bigger than 17 Mb if I remember,if they are less than that just use the standard Spreadsheet::WriteExcel
Yeah, I know that. What's I'm saying is that when you write with Spreadsheet::WriteExcel it makes the file huge. Then you open and save it in Excel and the files size reduces by A LOT.
Excel only allows roughly 6000 different formats in a given workbook.
S::WE will create a new format every time you call add_format(), even
if the format you're creating is identical to one you've already
created.
The fix is to create your format outside the loop and reuse it within the loop.
You are right, the file size is bigger before you save the file. SpreadsheetWriteExcel generate an xls 5.0/95. So when you save it will overwrite in the last excel format (small size)
One solution could be open and save the excel file by code. You could do it at the end of your script, it really the size matter
Using ParseExcel
use Spreadsheet:arseExcel::SaveParser;
my $oExcel = new Spreadsheet:arseExcel::SaveParser;
my $oBook = $oExcel->Parse('temp.xls');
$oExcel->SaveAs($oBook, 'temp.xls');
Using OLE:
use Win32::OLE;
$excel = new Win32::OLE ('Excel.Application', 'Quit');
$excel->{Visible} = 0;
$excel->Workbooks->Open("$file_name") or die ("Error: unable to
open document ", Win32::OLE->LastError());
$excel->SaveAs('$file_name');
undef $excel;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.