Hello, I triying to get the attributes (the first row of the excel) as objects, but I always get the next error:
Trying to get property of non-object
Excel::load($myFilePath, function($reader) {
// Getting all results
$results = $reader->toObject(); // I tried with "$reader->all();" too
// Loop sheets
$reader->each(function($sheet) {
// Loop rows
$sheet->each(function($row) {
$row->serialnumber; // Returns "Trying to get property of non-object"
});
});
});
I'm doing something wrong or is a bug?
If you only have 1 sheet in your file, the first loop will be the rows.
You can disable this behaviour in the config.
@patrickbrouwers
I have this error.
Trying to get property 'Relationship' of non-object (laravel excel version 3.1).
Most helpful comment
If you only have 1 sheet in your file, the first loop will be the rows.
You can disable this behaviour in the config.