2

Im loading a simple CSV file containing some long numbers.

-5605138260238298086
-5605138260238298086
-5605138260238297950
-5605138260238297950
-5605138260238297950
-5605138260238297950
-5604797085080996904

Trying to do a basic load of this CSV results in numbers that are returned as scientific notation like:

-5,60514E+18

How do I avoid getting a printout with scientific notation?

I've tried with the following:

if ( $ext == 'csv' ) {
    $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Csv");
} else {
    $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
}

$spreadsheet    = $reader->load( $movefile['file'] );
$data           = $spreadsheet->getActiveSheet()->toArray();

foreach ( $data as $row_key => $row ) {
   foreach ( $row as $cell_key => $cell ) {

        if ( $cell )
            $file_data[$row_key][$cell_key] = $cell;

   }
}
user1231561
  • 3,239
  • 6
  • 36
  • 55

0 Answers0