Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $test_location = "/test.xls"
- /**
- * @var \PHPExcel $excel
- * @var \PHPExcel_Reader_CSV $reader
- */
- /** @noinspection PhpUndefinedMethodInspection */
- $reader = \PHPExcel_IOFactory::createReader('CSV')
- ->setInputEncoding("euc-kr")
- ->setDelimiter("\t")
- ->setEnclosure('"')
- ->setSheetIndex(0);
- $excel = $reader->load($test_location);
- foreach ($excel->getWorksheetIterator() as $worksheet) {
- foreach ($worksheet->getRowIterator() as $row) {
- echo "<br/>" . ' Row number - ' , $row->getRowIndex(); echo "<br/><br/>";
- $cellIterator = $row->getCellIterator();
- $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
- foreach ($cellIterator as $cell) {
- if (!is_null($cell)) {
- echo $cell->getCoordinate() , ' - ' , $cell->getValue(), "<br />\n\r";
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment