Reputation: 3250
here is my code:
Excel::create($file_name, function ($excel) use ($data, $sheet_name) {
$excel->sheet($sheet_name, function ($sheet) use ($data) {
$data[] = ['id', 'customer', 'email', 'total', 'created_at'];
$data[] = ['1', '2', '3', '4', '5'];
$data[] = ['11', '2', '3', '4', '5'];
$data[] = ['111', '2', '3', '4', '5'];
$data[] = ['1111', '2', '3', '4', '5'];
$sheet->fromArray($data, null, 'A1', true, true);
});
// Set the title
$excel->setTitle('Our new awesome title');
// Chain the setters
$excel->setCreator('test')->setCompany('test');
// Call them separately
$excel->setDescription('A demonstration to change the file properties');
})->export($type);
And this is my output
why it is adding 0,1,2,3,4 at the top row ?
please help thanks
Upvotes: 1
Views: 7712
Reputation: 3250
instead of
$sheet->fromArray($data, null, 'A1', true, true);
it should be this
$sheet->fromArray($data, null, 'A1', false, false);
Upvotes: 3