Thursday, March 15, 2018

Laravel Excel import chunck null values - development

Laravel Excel import chunck null values

I’m importing an excel doc with “maatwebsite/excel”: “~2.1.0”, in Laravel 5.5.
Everithing work quite good but I have a problem because I would like to get cell properties.

I use chunk and chunk gave me an array, any option to call getCell property?

public function pruebaExcel(){    
    $target_dir = public_path('/down/');
    $target_file = $target_dir."default.xls";

   Excel::filter('chunk')
       ->selectSheets('Productos')
       ->load($target_file)
       ->chunk(100, function($rows){
            // NOT WORKING ->getCell, $sheet does not exist but I dont know how to do it
            // echo $sheet->getCell('V2')->getCalculatedValue();
            foreach ( $rows as $row ) {
                //WORKS
                echo $row['columName']; 
            }
        });
    }



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-excel-import-chunck-null-values/
via Lzo Media

No comments:

Post a Comment