require_once 'PHPExcel/Classes/PHPExcel.php'; $excel = PHPExcel_IOFactory::load("example.xlsx"); $worksheet = $excel->getSheet(0); // 0 denotes the first worksheet
require_once 'PHPExcel/Classes/PHPExcel.php'; $excel = PHPExcel_IOFactory::load("example.xlsx"); $worksheet = $excel->getSheetByName("Sheet2"); // retrieve worksheet by nameIn both examples, the getSheet() method is used to retrieve a worksheet from the Excel document. The first example retrieves the first worksheet by index, while the second example retrieves a worksheet by its name. The PHPExcel package library is used in both examples.