1

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

enter image description here

why it is adding 0,1,2,3,4 at the top row ?

please help thanks

1 Answer 1

3

instead of

 $sheet->fromArray($data, null, 'A1', true, true);

it should be this

$sheet->fromArray($data, null, 'A1', false, false);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.