Hi All,
I have a script which produces output in a Excel sheet. I use Win32::OLE. The file has 7 work sheets and one of them is quite big - 10 columns and 8000 to 10000 rows. I use a for loop to write the data cell by cell from an array. Most columns have string data except two which has date time values. This operation takes few minutes to complete.
Is there a way to speed it up by alternate methods (e.g.: creating CSV files and joining them together or such). Any comments and suggestions are welcome.
I don’t have much formatting at the moment, but need to introduce it also (bold/ italics/ colors).
Following is the piece of code I use currently.
$Sheet = $Book->Worksheets->Add;
$Sheet = $Book->Worksheets("Sheet7");
$Sheet->Activate();
$Sheet->{Name} = "BU Detail";
$range = 1;
foreach my $detail_line (@bu_detail)
{
my @detail_fields = split(/,/,$detail_line);
$Sheet->Range('A'.$range)->{Value} = $detail_fields[0];
$Sheet->Range('B'.$range)->{Value} = $detail_fields[1];
$Sheet->Range('C'.$range)->{Value} = $detail_fields[2];
$Sheet->Range('D'.$range)->{Value} = $detail_fields[3];
$Sheet->Range('E'.$range)->{Value} = $detail_fields[4];
$Sheet->Range('F'.$range)->{Value} = $detail_fields[5];
$Sheet->Range('G'.$range)->{Value} = $detail_fields[6];
$Sheet->Range('H'.$range)->{Value} = $detail_fields[7];
$Sheet->Range('I'.$range)->{Value} = $detail_fields[8];
$Sheet->Range('J'.$range)->{Value} = $detail_fields[9];
$range++;
}
@columnheaders = qw(A:J);
foreach $range(@columnheaders)
{
$Sheet->Columns($range)->AutoFit();
}
Regards
Joseph John
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
