Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Excel: how to get value of a cell?

I've loaded .xls file with Laravel Excel:

Excel::load('public/files/20160621.xls', function($reader) {
    // read a cell value
});

How do I read values of cells of the loaded excel file? Documentation seems to be unclear on that part.

like image 705
qwaz Avatar asked Mar 12 '23 20:03

qwaz


1 Answers

public function get()
{
    $excelFile ...
    return Excel::load($excelFile, function($doc) {

        $sheet = $doc->getSheetByName('data'); // sheet with name data, but you can also use sheet indexes.

        $sheet->getCell('A1');
        $sheet->getCellByColumnAndRow(0,0);           

    });
}

You're right, the documentation to read some cells is unclear. Hope this will help you.

like image 115
Demian Avatar answered Mar 14 '23 10:03

Demian