I'm trying to import excel files but it always give me this error:
PHPExcel_Exception
Row 2 is out of range (2 - 1)
I'm using Laravel 4 and here's my code:
public function postExcel()
{
$file = Input::file('file');
$destinationPath = public_path() .'/uploads/temp/';
$filename = str_replace(' ', '_', $file->getClientOriginalName());
$file->move($destinationPath, $filename);
$result = Excel::selectSheets('Sheet1')->load($destinationPath)->get();
echo "<pre>";
var_dump($result->toArray());
exit;
}
This is my dummy excel file:

I've tried to google this but for other it seems like it only occurs when the sheet is more than one, but it's not like that in my case.
load()ing thepublic/uploads/tempfolder, not the individual file.$result = Excel::selectSheets('Sheet1')->load($destinationPath)->get();line... when I change it to:$result = Excel::selectSheetsByIndex(0)->load($destinationPath, function($reader) { $reader->noHeading(); })->get();it gives no error but it returns null array... is it the excel file problem?selectSheets()before youload()the file, and I'd guess you should be doingload($destinationPath . $filename)for starters.