Laravel-Excel
Laravel-Excel copied to clipboard
[Bug]: Does not import when start row is greater than limit
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
- [X] Yes, it's still reproducable
What version of Laravel Excel are you using?
3.1.40
What version of Laravel are you using?
8.83.17
What version of PHP are you using?
8.0
Describe your issue
I'm using import concerns WithStartRow
&& WithLimit
together. I want to able to import 50 rows starting from row 100, but it was not importing. If the startRow is less than or equal to limit, then it is importing.
How can the issue be reproduced?
class UserImport implements ToModel, WithHeadingRow, WithChunkReading, WithEvents, WithStartRow, WithLimit
{
use Importable;
use RegistersEventListeners;
use RemembersRowNumber;
public function model(array $row)
{
$rowNo = $this->getRowNumber();
Log::info("Starting Import of Row $rowNo");
...
}
public function chunkSize(): int
{
return 500;
}
public function limit(): int
{
return 50;
}
public function startRow(): int
{
return 100; // Doesn't work
// return 50; // Works
// return 51; // Doesn't work
}
}
What should be the expected behaviour?
Expected to import from row no. 100 to 149.
Best to provide a failing unit test
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.