I use a large SQL statement to generate data for XLSX, this includes the use of concats in at least one place to reformat phone numbers to strip spaces and add a +1, as is required for this XLSX.
SELECT ...
FROM
(SELECT ...
case when p2.national_number is not null then concat('+1', p2.national_number) else p2.national_number end as PhoneNumber)
This is run inside a collection where Laravel Excel handles it from here
return collect($receipts);
The issue is the generated XLSX saves this as a Number, and it interprets the text field as a number, treating the addition of + as a positive number
This is not what I intended. The plus sign must be present. I have attempted to use columnFormats()
with the following settings, the same results persist.
public function columnFormats(): array
{
return [
'G' => NumberFormat::FORMAT_TEXT
];
}
Any recommendations on how to address this would be appreciated.