0
I have a PHP system reading data from a csv file. It displays the barcode number where I will relate to the database for update according to the file sent in the system. Example:
User sends CSV file with data: 'Bars' => 7896603803918, 'Qtd' => '1'
When reading the file I receive the value of bars: "7,8966E+12" which is not the same displayed in the correct value.
When opening the file. csv in excel, I actually find the text being displayed as "7,8966E+12", but when I click to check the value of the function, I get the correct number of 7896603803918.
My problem boils down to: The file . csv sends me an exponential number that does not represent the real number, making it impossible to import. What would be the right solution so that I could remove these values correctly from the . csv file or if it is a problem that everyone faces.
Code currently being used:
<?php
$csv = str_getcsv(file_get_contents('data.csv', 'r'), ';');
var_dump($csv);
The problem is that Excel or any other program that is using to generate the spreadsheet is recognizing the barcode as number and formatting, thus generating the wrong forum csv. You need to set the column as text in the editor
– Woss