Here is an example of this in the Documentation / Examples / Readers directory in the SVN repository for PHPEXcel: Example # 13
include 'PHPExcel/IOFactory.php'; $inputFileType = 'CSV'; $inputFileNames = array('./example1.csv','./example2.csv','./example3.csv','./example4.csv'); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $inputFileName = array_shift($inputFileNames); $objPHPExcel = $objReader->load($inputFileName); $objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); foreach($inputFileNames as $sheet => $inputFileName) { $objReader->setSheetIndex($sheet+1); $objReader->loadIntoExisting($inputFileName,$objPHPExcel); $objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); } $loadedSheetNames = $objPHPExcel->getSheetNames(); foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); echo $loadedSheetName,PHP_EOL; $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); var_dump($sheetData); echo PHP_EOL; }
source share