http://qs321.pair.com?node_id=419326

zeno has asked for the wisdom of the Perl Monks concerning the following question:

I am using Spreadsheet::WriteExcel. I need to add many worksheets to a workbook. I need either:
  1. Some way to reorder the worksheets alphabetically by name.
  2. A method of telling the add_worksheet method where to insert the new worksheet (it defaults to after the last sheet)
I tried selecting an existing worksheet before using add_worksheet, thinking this would insert the new worksheet after the selected one, but this did not work:
use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("foo.xls"); my $worksheet1 = $workbook->add_worksheet("alfa"); my $worksheet2 = $workbook->add_worksheet("charlie"); # Select "alfa" thinking "bravo" would insert after # it... it does not work. Final order remains # "alfa, charlie, bravo", not "alfa, bravo, charlie" # as desired. $worksheet1->select(); my $worksheet3 = $workbook->add_worksheet("bravo"); $workbook->close();

Any insights, perhaps a different module? Thanks.
-- Zeno - Barcelona Perl Mongers http://barcelona.pm.org http://www.javajunkies.org