mardi 26 juillet 2016

How to chunk a sheet which is selected by id in Laravel 5.1

I'm using Laravel 5.1 and ~2.1.0 version of Laravel-Excel. I was importing a xlsx file with various sheets, which can have more than 400 rows like this:

        $reader = Excel::selectSheetsByIndex(0)->load($file, function ($reader)
        {
            return $reader;
        })->toArray();

And it works but the waiting time is too long so I tried to chunk sheets one by one as I've read that chunking multiple sheets wasn't supported yet. But it always returns 0 rows.

$reader = Excel::filter('chunk')->selectSheetsByIndex(0)
          ->load($file)
          ->select($columns)
          ->chunk(250)
          ->toArray();

Can someone tell me what's the problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire