Is there a way to freeze the first row of the excel with Laravel Excel 3.1? [closed]

I´m using maatwebsite/excel 3.1 in Laravel 5.8 project.

I need to set the first row fixed when exporting the excel. What was known in version 2.1 as Freeze rows.

Excel::create('Filename', function($excel) {

   $excel->sheet('Sheetname', function($sheet) {





Since version 3 you should use native methods of PhpSpreadsheet.

You can try something like that:

class SomeExport implements ... // what you need to implement 
    // some other code
    public function registerEvents(): array
        return [
            AfterSheet::class => function(AfterSheet $event) {
                $workSheet = $event->sheet->getDelegate();
                $workSheet->freezePane('A2'); // freezing here

More info you can find here:



Leave a Reply

Your email address will not be published. Required fields are marked *