$objPHPExcel = new PHPExcel(); // Create some sheets $objPHPExcel->createSheet(0); $objPHPExcel->createSheet(1); $objPHPExcel->createSheet(2); // Remove sheet at index 1 $objPHPExcel->removeSheetByIndex(1);
$objPHPExcel = new PHPExcel(); // Create some sheets $objPHPExcel->createSheet(0); $objPHPExcel->createSheet(1); $objPHPExcel->createSheet(2); // Remove sheets at indexes 0 and 2 $objPHPExcel->removeSheetByIndex(2); $objPHPExcel->removeSheetByIndex(0);This example creates 3 sheets and then removes the sheet at indexes 0 and 2, which would be the first and last sheets in the spreadsheet. Note: The index numbers for sheets start at 0, so the first sheet in the spreadsheet would have an index of 0, the second sheet would have an index of 1, and so on.