When exporting currency items or items with the type format:
'type' => 'num-fmt',
Is there anyway for it to reflect this in excel to avoid the problems where excel warns about the column values being strings but looking like numbers.
So basically to define a column as being a number or currency column using export to excel.
I looked at exportOptions but I was not sure if this would solve the issue can anyone confirm if I am on the right track?
I think this question can be answered better on the main excel repo. Thanks!
Agreed but because I am using the button for excel at the top of the datatable I don't know what code this is actually calling to handle the export or I might be able to figure this out myself, can you tell me what code is being called by the buttons and if this is override-able?
You can override the function below to generate your custom excel handler.
/**
* Build excel file and prepare for export.
*
* @return \Maatwebsite\Excel\Writers\LaravelExcelWriter
*/
protected function buildExcelFile()
{
/** @var \Maatwebsite\Excel\Excel $excel */
$excel = app('excel');
return $excel->create($this->getFilename(), function (LaravelExcelWriter $excel) {
$excel->sheet('exported-data', function (LaravelExcelWorksheet $sheet) {
$sheet->fromArray($this->getDataForExport());
});
});
}
Thank you so much this should allow me to fix my issue :D
Most helpful comment
You can override the function below to generate your custom excel handler.