Skip Menu |

This queue is for tickets about the Spreadsheet-Wright CPAN distribution.

Report information
The Basics
Id: 131337
Status: open
Priority: 0/
Queue: Spreadsheet-Wright

People
Owner: Nobody in particular
Requestors: MERKYS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.105
Fixed in: (no value)



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.
I agree this would be an improved API. I'd happily accept a patch for it. Otherwise, I'll probably implement it myself, but not at a high priority.
On Fri Jan 03 10:35:25 2020, TOBYINK wrote: Show quoted text
> I'd happily accept a patch for it. Otherwise, I'll probably implement > it myself, but not at a high priority.
Great, I'll see what I can do about it.