I just started using Perl and I am using
Excel::Writer::XLSX
to query a DB2 database and export the data to an .xlsx file. The data is about 250k rows.
The script is running fine, but when I try to open the Excel file it throws an error and asks to repair the file. Upon repairing some of the data gets replaced by inf
.
Below is a snippet from my code.
while ( my $sqlStatement = ) {
$mSQL = $dbh->prepare( $sqlStatement )
or die "Can't prepare $sqlStatement";
$mSQL->execute()
or die "Can't execute $sqlStatement";
}
my $workbook = Excel::Writer::XLSX->new( $ARGV[2] );
$workbook->set_tempdir( '/tempDir/' );
$workbook->set_optimization();
my $worksheet = $workbook->add_worksheet();
$worksheet->keep_leading_zeros();
my $row = 0;
my $column = 0;
my @emptyRow = ();
$worksheet->write_row( $row++, $column, [ @{ $mSQL->{NAME_uc} } ] );
$worksheet->write_row( $row++, $column, [ @emptyRow ] );
while ( my @Row = $mSQL->fetchrow_array ) {
$worksheet->write_row( $row++, $column, [ @Row ] ); #, $cellFormat);
$count++;
}
$workbook->close();
Can someone please advise me on this issue?