Reputation: 43
I am trying to import an excel using Laravel with dynamically changing columns(names as well as sequence) . I am looking for a way to map these columns against Sql db columns.
Upvotes: 1
Views: 185
Reputation: 11
Please share your code for clarification;
you can use this package to import and change dynamically in callback;
https://github.com/rap2hpoutre/fast-excel
$users = (new FastExcel)->import('file.xlsx', function ($line) {
//here you can perform custom action on your data
return User::create([
'name' => $line['Name'],
'email' => $line['Email']
]);
});
Upvotes: 1