I am using Laravel 5.4,
I want to import an excel sheet into mysql,
I use Laravel-Excel
package to do this,
I read the docs but I don't know how to insert the excel file's content into mysql after loading it.
docs:http://www.maatwebsite.nl/laravel-excel/docs/import
For example:
There is an article
table in mysql database,it has these columns:
id title content created_at updated_at
And there is an excel file article.xls
,it has the same columns as article
table.
id title content created_at updated_at
1 example1 example1's content 2017-04-02 00:00:00 2017-04-02 00:00:00
2 example2 example2's content 2017-04-02 00:00:00 2017-04-02 00:00:00
I use Laravel-Excel
to load this excel file:
Excel::load('article.xls', function($reader) {
// reader methods
});
Question:
How to insert the excel file's content into article
table?
via zwl1619