Open codenesiareborn opened 2 weeks ago
I'm facing this issue too in Laravel Excel 3.1.55, using Laravel 9.52 and PHP 8.3.8:
class TestImport implements ToArray, WithStartRow, SkipsEmptyRows, WithMultipleSheets, WithChunkReading, ShouldQueue
{
public function __construct(private readonly User $user)
{
}
public function array(array $array): void
{
foreach ($array as $index => $row) {
ProcessExcelQuote::dispatch($row, $this->user, $index);
}
}
public function sheets(): array
{
return [
'0' => $this
];
}
public function startRow(): int
{
return 3;
}
public function chunkSize(): int
{
return 10;
}
}
After reading a sheet with 3 rows it keeps on reading:
2024-09-17 18:14:54 Maatwebsite\Excel\Jobs\QueueImport ................................................................................................................................................................................................................................................. RUNNING
2024-09-17 18:14:54 Maatwebsite\Excel\Jobs\QueueImport ........................................................................................................................................................................................................................................... 158.79ms DONE
2024-09-17 18:14:54 Maatwebsite\Excel\Jobs\ReadChunk ................................................................................................................................................................................................................................................... RUNNING
2024-09-17 18:14:55 Maatwebsite\Excel\Jobs\ReadChunk ............................................................................................................................................................................................................................................. 508.37ms DONE
2024-09-17 18:14:55 App\Jobs\ProcessExcelQuote ......................................................................................................................................................................................................................................................... RUNNING
2024-09-17 18:14:57 App\Jobs\ProcessExcelQuote ................................................................................................................................................................................................................................................. 2,091.42ms FAIL
2024-09-17 18:14:57 App\Jobs\ProcessExcelQuote ......................................................................................................................................................................................................................................................... RUNNING
2024-09-17 18:14:58 App\Jobs\ProcessExcelQuote ................................................................................................................................................................................................................................................. 1,349.21ms FAIL
2024-09-17 18:14:58 App\Jobs\ProcessExcelQuote ......................................................................................................................................................................................................................................................... RUNNING
2024-09-17 18:15:00 App\Jobs\ProcessExcelQuote ................................................................................................................................................................................................................................................. 1,696.43ms FAIL
2024-09-17 18:15:00 Maatwebsite\Excel\Jobs\ReadChunk ................................................................................................................................................................................................................................................... RUNNING
2024-09-17 18:15:01 Maatwebsite\Excel\Jobs\ReadChunk ............................................................................................................................................................................................................................................. 422.58ms DONE
2024-09-17 18:15:01 Maatwebsite\Excel\Jobs\ReadChunk ................................................................................................................................................................................................................................................... RUNNING
2024-09-17 18:15:01 Maatwebsite\Excel\Jobs\ReadChunk ............................................................................................................................................................................................................................................. 399.25ms DONE
I believe it might have something to do with having created the .xlsx
file from Google Sheets, which seems to append a bunch of rows at the end of the sheet
I'm facing this issue too in Laravel Excel 3.1.55, using Laravel 9.52 and PHP 8.3.8:
class TestImport implements ToArray, WithStartRow, SkipsEmptyRows, WithMultipleSheets, WithChunkReading, ShouldQueue { public function __construct(private readonly User $user) { } public function array(array $array): void { foreach ($array as $index => $row) { ProcessExcelQuote::dispatch($row, $this->user, $index); } } public function sheets(): array { return [ '0' => $this ]; } public function startRow(): int { return 3; } public function chunkSize(): int { return 10; } }
After reading a sheet with 3 rows it keeps on reading:
2024-09-17 18:14:54 Maatwebsite\Excel\Jobs\QueueImport ................................................................................................................................................................................................................................................. RUNNING 2024-09-17 18:14:54 Maatwebsite\Excel\Jobs\QueueImport ........................................................................................................................................................................................................................................... 158.79ms DONE 2024-09-17 18:14:54 Maatwebsite\Excel\Jobs\ReadChunk ................................................................................................................................................................................................................................................... RUNNING 2024-09-17 18:14:55 Maatwebsite\Excel\Jobs\ReadChunk ............................................................................................................................................................................................................................................. 508.37ms DONE 2024-09-17 18:14:55 App\Jobs\ProcessExcelQuote ......................................................................................................................................................................................................................................................... RUNNING 2024-09-17 18:14:57 App\Jobs\ProcessExcelQuote ................................................................................................................................................................................................................................................. 2,091.42ms FAIL 2024-09-17 18:14:57 App\Jobs\ProcessExcelQuote ......................................................................................................................................................................................................................................................... RUNNING 2024-09-17 18:14:58 App\Jobs\ProcessExcelQuote ................................................................................................................................................................................................................................................. 1,349.21ms FAIL 2024-09-17 18:14:58 App\Jobs\ProcessExcelQuote ......................................................................................................................................................................................................................................................... RUNNING 2024-09-17 18:15:00 App\Jobs\ProcessExcelQuote ................................................................................................................................................................................................................................................. 1,696.43ms FAIL 2024-09-17 18:15:00 Maatwebsite\Excel\Jobs\ReadChunk ................................................................................................................................................................................................................................................... RUNNING 2024-09-17 18:15:01 Maatwebsite\Excel\Jobs\ReadChunk ............................................................................................................................................................................................................................................. 422.58ms DONE 2024-09-17 18:15:01 Maatwebsite\Excel\Jobs\ReadChunk ................................................................................................................................................................................................................................................... RUNNING 2024-09-17 18:15:01 Maatwebsite\Excel\Jobs\ReadChunk ............................................................................................................................................................................................................................................. 399.25ms DONE
I believe it might have something to do with having created the
.xlsx
file from Google Sheets, which seems to append a bunch of rows at the end of the sheet
how can we skip the empty rows?
I'm facing this issue too in Laravel Excel 3.1.55, using Laravel 11.20.0 and PHP 8.3.11
But it's on a job named ImportTextsTranslations
$import = new TranslationImport();
Excel::import($import, storage_path('app/' . $file));
class TranslationImport implements ToCollection, WithHeadingRow, WithMultipleSheets
{
// In case of the file having multiple sheets, this method will be called multiple times.
#[\Override]
public function collection(Collection $rows)
{
// My customer code here
}
// Force to ignore other sheets that translator adds that crash the import
#[\Override]
public function sheets(): array
{
return [
0 => $this,
];
}
}
I got this problem only while importing multiples files. If i was importing them one by one, i was fine.
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.30
What version of Laravel are you using?
9.19
What version of PHP are you using?
8.2.0
Describe your issue
Maatwebsite\Excel\Jobs\ReadChunk still runs when all excel rows have been imported
How can the issue be reproduced?
`class BulkConnectExcelImport implements WithMultipleSheets, ShouldQueue, WithChunkReading {
}`
What should be the expected behaviour?
the job should stop when all rows are successfully uploaded