1
votes

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?

1
Finally, after reading the vendor codes, just found this method getTotalRowsOfFile() Solved!hellilyntax

1 Answers

1
votes

Use this method to get row count. Then manipulate it.

->getTotalRowsOfFile()