Laravel Excel - 获取活动单元格或行

That's a simple question.

I'm building a PHP Excel from scratch and is a very useful package. I need to catch the active cell or row to know which cells to modify and customize, I checked all methods in the package and I didn't found something that helped me. I'm inserting some data like this:

$sheet->appendRow(array(
                $variable->value1,
                $variable->value2,
                $variable->value3,
            ));

And then I want to customize some things(This example I'm changing the background color), something like:

//The XXX is the last active row that I append some value before
$sheet->cells('XXXX',function ($cells){
                $cells->setBackground('#34EC34');
            });

There's some way to do find out the active cell or row to put in place of the 'XXX'? I found some question on Stack that someone was accessing by the variable $row, but I didn't found how to access....

  1. go to class name "LaravelExcelWorksheet" in vendor/maatwebsite/excel/src/Maatwebsite/Excel/Classes/LaravelExcelWorksheet.php

  2. Try to change method modifier of getStartRow from protected to public

  3. You can use it with $sheet->getStartRow(), that's show you active row