http://www.perlmonks.org?node_id=722716

My input Excel file has four worksheets; I wanted to delete worksheet #2 and save the spreadsheet. There is no function to delete a worksheet in Spreadsheet::ParseExcel nor SpreadSheet::WriteExcel, as they assume that if you didn't want the sheet, you wouldn't have created it.
#!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my ($INFILE,$OUTFILE)=("in.xls","out.xls"); my $oExcel = new Spreadsheet::ParseExcel::SaveParser; my $oBook = $oExcel->Parse($INFILE); splice(@{$oBook->{Worksheet}},1,1); $oBook->{SheetCount}--; $oExcel->SaveAs($oBook, $OUTFILE);