Laravel-excel: [QUESTION] Export Excel Progress

Created on 18 Feb 2019  路  18Comments  路  Source: Maatwebsite/Laravel-Excel

Versions

  • PHP version: 7.2.15
  • Laravel version: 5.7.26
  • Package version: 3.1

Description

It is possible to dispatch a Job every chunk_size has been processed ?? To make a pusher and complete a progressbar.

Thanks.

enhancement

Most helpful comment

I'll see if I can make a nice thing for this.

All 18 comments

AfterSheet event gets raised after every chunk is processed, so you can use that event to raise a broadcast event.

I'm not sure this actually works as on an export of 34k records, I set the chunkSize to 100, and I only got one event of AfterSheet and then shortly after, the script was completed and all the records were exported. If it makes any difference, I'm just exporting to a csv not excel, but either way I was hoping it would still work.

I'll try to reproduce, but looking at the code, it should raise the event every chunk.

$this->raise(new AfterSheet($this, $this->exportable));

Gets executed in every chunk read.

The [afterSheet] is only fired after Maatwebsite\Excel\Jobs\CloseSheet event on the end.

image

The TesteJob is fired on afterSheet only at the end.

image

Sorry for some reason thought it was about imports, think the "chunk" word got me thinking that way :)
For exports it indeed only executes when it Closes the sheet (CloseSheet) job.
There's currently no event that gets raised after each export job.

Yeah, it would by nice to show the progress into the client.

Thanks.

I'll see if I can make a nice thing for this.

Hi, any news ??

Thanks.

@lbenevenuto No news yet, it's also not really high on our current to do list. If you want to get this prioritize you could consider getting it on commercial support base; you can see the options here; https://laravel-excel.com/commercial-support

+1 for this feature

@patrickbrouwers for this feature just needed to raise event on each chunk process right?

+1 for this feature for Export _and_ especially for Import.

@patrickbrouwers why this issue was closed?

We have decided to not implement this feature in the package as it's not something we are willing to maintain. Also queued chunks will be replaced in the next release.

Hello! Is it still not implemented yet? Each time interface FromQuery executes sql, we can increment variable with retrieved records count and pass it to next job. And before dispatching that job - fire new event AfterWriting with total count, and total processed count. Am I wrong? Thank you

As I said, we won't add it to the package

@patrickbrouwers just raising an event after each export job, is it a big problem and requires active maintenance?

Every line that is added I ultimately have to maintain. I've been open for a PR for an event, just not for the entire progress logic in the package.

Was this page helpful?
0 / 5 - 0 ratings