// Load the Excel file into PHPExcel object $objPHPexcel = PHPExcel_IOFactory::load('example.xlsx'); // Retrieve the number of worksheets in the Excel file $sheetCount = $objPHPexcel->getSheetCount(); echo "This Excel workbook has " . $sheetCount . " worksheets.";
// Create a new Excel workbook $objPHPexcel = new PHPExcel(); // Add three worksheets to the workbook $objPHPexcel->createSheet(); $objPHPexcel->createSheet(); $objPHPexcel->createSheet(); // Retrieve the number of worksheets in the Excel file $sheetCount = $objPHPexcel->getSheetCount(); echo "This Excel workbook has " . $sheetCount . " worksheets.";In this example, we create a new Excel workbook using the PHPExcel library. We then add three worksheets to the workbook using the createSheet() method. Finally, we use the getSheetCount() method to retrieve the total number of worksheets in the workbook and display it on the screen. Based on the code examples provided, it can be determined that the package library being used is PHPExcel.