# Headings

# Adding a heading row

A heading row can easily be added by adding the WithHeadings concern. The heading row will be added as very first row of the sheet.


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

class InvoicesExport implements FromQuery, WithHeadings
{
    public function headings(): array
    {
        return [
            '#',
            'User',
            'Date',
        ];
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

If you need to have multiple heading rows, you can return multiple rows from the headings() method:


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

class InvoicesExport implements FromQuery, WithHeadings
{
    public function headings(): array
    {
        return [
           ['First row', 'First row'],
           ['Second row', 'Second row'],
        ];
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14