mardi 29 juin 2021

Laravel excel add complex headers to an export

I need to export a sheet with a complex heading via Laravel Excel. I need a main heading and another sub-level heading after.

enter image description here

I'm trying like this,

use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;

class InvoicesExport implements FromQuery, WithHeadings
{   
    public function headings(): array
    {
        return [
            'Account 1' =>[
                "Account 1 id",
                "Account 1 branch"  
            ],
            'Account 2' =>[
                "Account 2 id",
                "Account 2 branch"  
            ],
        ];
    }
}

But getting header columns like, [ "Account 1 id", "Account 1 branch" ]

is there a way to archive this task?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire