PHPExcel Reader Example #12

Simple File Reader for Tab-Separated Value File using the Advanced Value Binder

'; $objReader->setDelimiter("\t"); $objPHPExcel = $objReader->load($inputFileName); $objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); echo '
'; echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded

'; $loadedSheetNames = $objPHPExcel->getSheetNames(); foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Formatted)
'; $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); var_dump($sheetData); echo '
'; } echo '
'; foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Unformatted)
'; $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,false,true); var_dump($sheetData); echo '
'; } echo '
'; foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Raw)
'; $objPHPExcel->setActiveSheetIndexByName($loadedSheetName); $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true); var_dump($sheetData); echo '
'; } ?>