Laravel-excel: Trying to get property of non-object

Created on 17 Sep 2015  路  2Comments  路  Source: Maatwebsite/Laravel-Excel

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?

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.

All 2 comments

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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amine8ghandi8amine picture amine8ghandi8amine  路  3Comments

alejandri picture alejandri  路  3Comments

lucatamtam picture lucatamtam  路  3Comments

ellej16 picture ellej16  路  3Comments

pamekar picture pamekar  路  3Comments