rap2hpoutre / fast-excel

🦉 Fast Excel import/export for Laravel
MIT License
2.09k stars 245 forks source link

Import large excel file using package fast-excel with validation #245

Open hasanhadi opened 2 years ago

hasanhadi commented 2 years ago

Hi how can using package fast-excel for import large excel file more 100K rows with validation if you have code for more information Thanks

Franckevarice commented 2 years ago

hello here, I have the same problem. need help please

otsabi94 commented 2 years ago

same problem

StefanoTesla commented 2 years ago

I think, you need to import and validate by yourself, Laravel Excel have this feature but ram usage is different.

In my case FastExcel use 20Mb of ram, Laravel Excel used 176mb...

sektonic commented 11 months ago

use this

$users = (new FastExcel)->import('file.xlsx', function ($line) {
    Validator::make($line, [
        'Email' => 'required',
        'Name' => 'required',
        'Password' => 'required',
    ]);

    return User::create([
        'email' => $line['Email'],
        'name' => $line['Name'],
        'password' => Hash::make($line['Password'])
    ]);
});