Subject: | Initialize the default sheet (if needed) only when inserting the first row |
Currently, the first sheet has to be specified in Spreadsheet::Wright->new() call, at least for ODS and XLS formats. Therefore, if one has an array of tables (say @tables) prepared beforehand, one has to do:
my $s = Spreadsheet::Wright->new( sheet => $tables[0], file => "file.xls" );
foreach (@tables) {
if( !table_is_first( $_ ) ) {
$s->addsheet( $_ );
}
fill_in_the_spreadsheet_for_table( $s, $_ );
}
It would be much easier if one could do the following instead:
my $s = Spreadsheet::Wright->new( file => "file.xls" );
foreach (@tables) {
$s->addsheet( $_ );
fill_in_the_spreadsheet_for_table( $s, $_ );
}
Currently the latter example does not work due to a default sheet 'Sheet1' being inserted during Spreadsheet::Wright->new() call.