Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel-Excel (MaatWebSite) takes to long reading

I dont know what im doing wrong, or maybe its something normal. I have to load and "read" a excell with about 12000 rows. I use this code for that.

Excel::selectSheetsByIndex(0)->load($path.$fileName, function ($reader) {
    $reader->each(function($row){
        Log::info('$row');
    });
});

As you can see, there is nothing heavy wich could make the read so slow. I need to process hte data after the reading, so is a problem if only reading takes more than 5-10 minutes.

I tried also with the chunk filter, but nothing went better.

Is this normal?

I know excel reading is slow, as i read in other questions, but "this" slow? Thank you.

like image 833
Sampudon Avatar asked Nov 08 '22 15:11

Sampudon


1 Answers

You could use Laravel Fast Excel which aims to be faster. It has less feature, but it's OK for a simple XLSX import.

(new FastExcel)->import('your-file.xlsx', function ($row) {
    // Do what you want with this line, you can use it as an array.
    dump($row);
});
like image 136
rap-2-h Avatar answered Nov 14 '22 22:11

rap-2-h