I am exporting to excel using "maatwebsite/excel": "^3.1", but when I export, columns with values 0 or 0.0 are ignored and the cell is left empty. sample code:
public function array(): array
{
return $this->data;
}
public function columnFormats(): array
{
return [
'C' => NumberFormat::FORMAT_TEXT,
'E' => '0.00',
'F' => '0.00',
'G' => '0.00'
];
}
public function map($rows): array
{
return [
$rows['employeeNumber'],
$rows['basicSalary'],
$rows['totalAllowance'],
$rows['grossSalary']
];
}
when values for the columns are 0 or 0.00, nothing is inserted in the cell.
Kindly try with this
number_format((float)$value, 2, '.', '');