Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

emfpc's avatar
Level 1

Laravel Exporting to Excel Number Field

Greetings. Currently i'm working with a export plug in where i must export data to excel everything works on my end but were i need the field to display example Credit Card Number of 16 character it round it. i have tried to format the column but it won't work in some cases. Is there a way a can bypass the format?

The Export Code: ' public function columnFormats(): array { return [ 'X' => NumberFormat::FORMAT_NUMBER, 'P' => NumberFormat::FORMAT_CURRENCY_USD, ]; }

public function view(): View{
    $guests=Guest::all();
    return view('form.export',compact('guests'));
}

'

The P column works which add the $ sign

0 likes
1 reply

Please or to participate in this conversation.