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

I can create an Excel 2003 File with one spreadsheet but how can I create an Excel File with two spreadsheets?
#this creates one spreadsheet but I need 2 spreadsheets use Spreadsheet::WriteExcel; my $r = new cgi; # print "Content-type: application/vnd.ms-excel\n\n"; # Create a new workbook called simple.xls and add a worksheet my $workbook = Spreadsheet::WriteExcel->new("simple.xls"); my $worksheet = $workbook->addworksheet();

Replies are listed 'Best First'.
Re: Create Excel SpreadsheetS
by jettero (Monsignor) on Dec 28, 2006 at 12:21 UTC

    I believe you just add another sheet with my $anothersheet = $workbook->add_worksheet('mah name be page two').

    -Paul

      lol mah name be page 2
        Thanks it now works. Any way I can get this on a web page where someone can click on a CGI/Perl link and it will show the Excel File?
        use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("C:/myfile.xls"); $worksheet = $workbook->add_worksheet(); $worksheet->write('A1', "Hi Exclel!"); $worksheet = $workbook->add_worksheet(); $worksheet->write('A1', "Next spreadsheet");