Laravel-excel: [QUESTION]Memory exhausted when I use queue export

Created on 11 Mar 2019  路  5Comments  路  Source: Maatwebsite/Laravel-Excel

Prerequisites

Versions

  • PHP version: 7.1.5
  • Laravel version: 5.7
  • Package version: 3.1.0

Description

I have over 400,000 rows of data in table.Then I follow the documentation, execute scripts as queue.
But something as wrong so that the script can not be executed properly.
img

ExcelCommand.php

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Exports\ExcelExport;

class Export extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'export:excel';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'export excel';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        (new ExcelExport)->store("demo.xlsx");
        $this->info("export success");
    }
}



?>

ExcelExport.php

<?php

namespace App\Exports;

use App\Models\Excel;
use Illuminate\Contracts\Queue\ShouldQueue;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;

class ExcelExport implements FromQuery, ShouldQueue
{
    use Exportable;

    public function query()
    {
        return Excel::query();
    }
}


?>

Additional Information

Most helpful comment

Perhaps you could try assigning some more memory? (reference)
Or try using FromIterator instead.

Thank you very much for suggestion. I had to give up using laravel-excel. I hope that in the near future, laravel-excel will support big data more friendly

Version 3.2 will have cell caching, which should decrease the amount of memory issues.
I don't have an expected release date for 3.2 yet.

All 5 comments

Perhaps you could try assigning some more memory? (reference)
Or try using FromIterator instead.

Perhaps you could try assigning some more memory? (reference)
Or try using FromIterator instead.

Thank you very much for suggestion. I had to give up using laravel-excel. I hope that in the near future, laravel-excel will support big data more friendly

Perhaps you could try assigning some more memory? (reference)
Or try using FromIterator instead.

Thank you very much for suggestion. I had to give up using laravel-excel. I hope that in the near future, laravel-excel will support big data more friendly

Version 3.2 will have cell caching, which should decrease the amount of memory issues.
I don't have an expected release date for 3.2 yet.

Version 3.2 will have cell caching, which should decrease the amount of memory issues.

So exciting! I'm looking forward to the next version.

Perhaps you could try assigning some more memory? (reference)
Or try using FromIterator instead.

There is no documentation about FromIterator method. Could please someone explain me, how do you use FromIterator method with Queued Export? Thank you in advance!

Was this page helpful?
0 / 5 - 0 ratings