Level 5
instead of doing
$sheet->fromArray($ex_array);
do like this
$sheet->fromArray($ex_array, null, 'A1', true);
it works..!!
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Guys iam working with project.
i used maatwebsite to export excel files.
my problem is when the value 0 is exported, it is exported as an empty cell
my code to export
$ex = Personal_account::get();
foreach($ex as $e)
{
$ex_array[]=array(
' Date'=>$e->date->format('d-m-Y'),
' Vendor Name'=>$e->vendor_name,
'Vendor Location'=>$e->vendor_location,
' Vendor Booth'=>$e->vendor_booth,
'Amount'=>$e->amount,
'Note'=>$e->note,
);
}
Excel::setValueBinder($valueBinder)->create('Personalaccounts', function($excel) use ($ex_array) {
$excel->sheet('mySheet', function($sheet) use ($ex_array)
{
$sheet->fromArray($ex_array);
});
})->download('xlsx');
how to rectify this
Kindly help please
instead of doing
$sheet->fromArray($ex_array);
do like this
$sheet->fromArray($ex_array, null, 'A1', true);
it works..!!
Please or to participate in this conversation.