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
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
Yes, it's still reproducable
What version of Laravel Excel are you using?
3.1
What version of Laravel are you using?
9.41
What version of PHP are you using?
8.1.0
Describe your issue
Hello,
I am trying to read the data of a XLSX file and import them into DB. Until now, I produced excel files using my LibreOffice and the SkipsEmptyRows interface in order to read file line by line and ignore empty rows. However, when I created the same Excel file with the same data in Google Docs, for some reason empty rows are not ignored. After some research, I found that google docs create rows with an empty string. Please find below a file example with this problem.
So, my question is how can I skip rows / cells which include empty strings ?
I tried the following but with no success
Update the variable ignore_empty => true, in config/excel.php
registerEvents
public function registerEvents(): array { return [ BeforeImport::class => function (BeforeImport $event)
{ return $event->getReader()->getPhpSpreadsheetReader()->setReadEmptyCells(false); } ];
I noticed that the calculation of total rows is coming from the function listWorksheetInfo which is into vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Xlsx.php
The weird thing here is that while it's reading the file and storing the total numbers of rows, it jumps suddenly from "real" total number of rows to a "magic" number of rows.
Does anyone have explanation about this? Or how can I manage it in order to ignore these empty lines?
Extra Note : I am using the WithChunkReading interface in order to keep the memory usage under control & OnEachRow interface in order to process each row's data
This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions.
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
What version of Laravel Excel are you using?
3.1
What version of Laravel are you using?
9.41
What version of PHP are you using?
8.1.0
Describe your issue
Hello,
I am trying to read the data of a XLSX file and import them into DB. Until now, I produced excel files using my LibreOffice and the
SkipsEmptyRows
interface in order to read file line by line and ignore empty rows. However, when I created the same Excel file with the same data in Google Docs, for some reason empty rows are not ignored. After some research, I found that google docs create rows with an empty string. Please find below a file example with this problem.So, my question is how can I skip rows / cells which include empty strings ?
I tried the following but with no success
Update the variable
ignore_empty => true
, in config/excel.phpregisterEvents
I noticed that the calculation of total rows is coming from the function
listWorksheetInfo
which is into vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Xlsx.phpThe weird thing here is that while it's reading the file and storing the total numbers of rows, it jumps suddenly from "real" total number of rows to a "magic" number of rows.
Does anyone have explanation about this? Or how can I manage it in order to ignore these empty lines?
Extra Note : I am using the
WithChunkReading
interface in order to keep the memory usage under control &OnEachRow
interface in order to process each row's dataSampleExample (1).xlsx
How can the issue be reproduced?
To set a counter about the total number of rows instead of reading
$xml->getAttribute('r')
What should be the expected behaviour?
In this case the total of number of rows should be 15 and not 1048576
The text was updated successfully, but these errors were encountered: