Laravel Excel export removed last 0 from float number

Viewed 36

I have below values in my database. When I am exporting the same it removes last 0. So 1.10 display as 1.1.

I tried formatting using FORMAT_NUMBER_00 but it adds 0 at the last even not required.

It should display 1.10 instead of 1.1

1 Answers

I got a solution and posting here to help someone else.

use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use \PhpSpreadsheet\Cell\StringValueBinder

class QuestionnaireExport extends StringValueBinder implements FromCollection, WithCustomValueBinder

It does a trick & export excel in original format without removing 0's at last.

Related