Laravel-Excel: Row 2 is out of range (2 - 1)
I use this code
$fileName = '/var/www/file.xls';
Excel::load($fileName, function($reader) {
})->get();
And I get this error
PHPExcel_Exception in RowIterator.php line 125 Row 2 is out of range (2 - 1)
in RowIterator.php line 125
at PHPExcel_Worksheet_RowIterator->seek('2') in RowIterator.php line 99
at PHPExcel_Worksheet_RowIterator->resetStart('2') in RowIterator.php line 81
at PHPExcel_Worksheet_RowIterator->__construct(object(PHPExcel_Worksheet), '2', null) in Worksheet.php line 2568
at PHPExcel_Worksheet->getRowIterator('2') in ExcelParser.php line 329
at ExcelParser->parseRows() in ExcelParser.php line 182
at ExcelParser->parseWorksheet() in ExcelParser.php line 132
at ExcelParser->parseFile(array()) in LaravelExcelReader.php line 1024
at LaravelExcelReader->_parseFile(array()) in LaravelExcelReader.php line 473
Problem seems to be that the Excel file has more than one Pages.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 28 (8 by maintainers)
Commits related to this issue
- Workaround for Row is out of range issue, fixes issue #437 — committed to SpartnerNL/Laravel-Excel by patrickbrouwers 9 years ago
- Workaround for Row is out of range issue, fixes issue #437 — committed to SpartnerNL/Laravel-Excel by patrickbrouwers 9 years ago
- Merge pull request #455 from Maatwebsite/2.0 Workaround for Row is out of range issue, fixes issue #437 — committed to SpartnerNL/Laravel-Excel by patrickbrouwers 9 years ago
I am encountering some strange issues.
When I use
Excel::selectSheetsByIndex(0)->load($path)->get();
, it works fine. But when I change that toExcel::selectSheetsByIndex(3)->load($path)->get();
(Please note that instead of selecting the first sheet, I am trying to select the fourth sheet.), it returns me an empty arrary. And any code after than to get data from the sheets return an empty array.For example,
Excel::selectSheets('GradeReports')->load($path)->get();
returns an empty array, if I useselectSheetsByIndex
for any sheet other than the first sheet.@lollypopgr Did you include in the file a table header (aka column names)? If not, try calling noHeading(), otherwise, you’ll get an error on single-row files.