Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getexcel($file)
- {
- $reader = IOFactory::createReader('Xlsx');
- $reader->setReadDataOnly(TRUE);
- $spreadsheet = $reader->load($file);
- $worksheet = $spreadsheet->getActiveSheet();
- $highestRow = $worksheet->getHighestRow();
- $highestColumn = $worksheet->getHighestColumn();
- $highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn);
- for ($row = 1; $row <= $highestRow; ++$row)
- {
- $exceldata[($row-1)] = array();
- for ($col = 1; $col <= $highestColumnIndex; ++$col)
- {
- $value = $worksheet->getCellByColumnAndRow($col, $row)->getValue();
- $exceldata[($row-1)][] = $value;
- }
- }
- return $exceldata;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement