Reputation: 187
I'm using Laravel 4 and Maatwebsite Laravel Excel to import form CSV files.
I managed to import each rows in the csv file successfully.
How ever, when it comes to empty files, the site returns: Row 2 is out of range (2 - 1).
Here is my code:
Excel::load($source, function($reader) {
$reader->all();
})
Is there any way to bypass empty row or to verify row count before process?
Upvotes: 1
Views: 2724
Reputation: 187
Use this method to get row count. Then manipulate it.
->getTotalRowsOfFile()
Upvotes: 1