I am creating a module that you load into the database from an excel file. These are just phone numbers. So here is my code:
$file = Input::file('file');
Excel::load($file, function($reader) {
$results = $reader->get()->toArray();
foreach ($results as $key => $value) {
$phone = new Phone();
$phone->msisdn = $value['msisdn'];
$phone->save();
}
});
I am using https://github.com/Maatwebsite/Laravel-Excel to read the excel file. It works fine, 20,000 records load in 20 minutes, I think there is a way for it or load it faster? I know this also depends on the server, but are there other factors? I am using MySQL
thanks
source
share