You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reader reports (non-existent) extra blank rows in Excel sheet #95
I have a large-ish spreadsheet (3019 rows inc. header row) that the ExcelReader seems to be finding an extra 7 rows in ($reader->count() yields 3026). I'm no Excel expert, but my manual attempts to find any columns with hidden characters, deleting all rows from 3020 -> 10000 and writing a macro to count the rows all seem to say there are only 3019 rows.
It's entirely possible I'm awful with Excel, and just can't see some hidden characters, but even an iteration in my code over rows 3018 -> $reader->count(), all columns are indeed "NULL".
Within my code, I have this, where $file is the attached file 'Master List.xlsx'
$file = new \SplFileObject($file->getPathname());
try {
$reader = newExcelReader($file, 0, 0);
echo('count:'.$reader->count()); // 3026$this->ensureColumnHeadersMatchExpected($reader);
$this->remapColumnHeadersToEntityMapping($reader);
// Need to alter the reader, so convert to array; changes to the Reader object aren't persisted in the object memory$items = iterator_to_array($reader);
echo('count:'.$items); // Still 3026, obviously// As of late 2018, the reader appears to think that the spreadsheet has an extra 7 rows that are blank...// This is even after swapping phpexcel for port/excel...wtf.$this->removeEmptyRows($items);
$this->splitAndMapRelations($items);
$this->sanitize($items);
// Return a plain 'ol arrayreturn$items;
} catch (\PHPExcel_Reader_Exception$e) {
thrownewLibraryItemImporterException($e->getMessage());
} catch (LibraryItemImporterException$e) {
throw$e;
}
Activity