title: php League-CSV: floating numbers are rendered as text in the CSV file
body: <p>I am using <a href="https://github.com/thephpleague/csv" rel="nofollow noreferrer">League CSV</a> package (v9.0) to write data into CSV file, Unfortunately it exports floating numbers as a text and not as numbers. I want them to remain as numbers so that basic operations such as SUM, Count can be done using the Excel or OpenOffice.</p>
  
  <p>Here is the data that i want to insert into the csv file.</p>
  
  <pre><code>$data = array(
   [
     'header1' =&gt; 12.02,
     'header2' =&gt; 32.4,
     'header3' =&gt; "sadsa",
     'header4' =&gt; "rete",
     'header5' =&gt; "tet"
   ],
   [
     'header1' =&gt; 14.02,
     'header2' =&gt; 35.4,
     'header3' =&gt; "blabla2",
     'header4' =&gt; "rete",
      'header5' =&gt; "tet"
    ],
  ); 
  </code></pre>
  
  <p>To insert the data using League CSV</p>
  
  <pre><code>$writer = Writer::createFromPath($filePath,'w+');
  //$header = $this-&gt;getHeaderFromData($FileData);
  $writer-&gt;setDelimiter(";");
  //$writer-&gt;insertOne($header);
  $writer-&gt;insertAll(new \ArrayIterator($data));
  </code></pre>
  
  <p>also same result using fputcsv()</p>
  
  <pre><code>$file = fopen("/tmp/test.csv","w");
  
      foreach ($data as $value) {
          fputcsv($file,$value,";",'"');
      }
  fclose($file);
  </code></pre>
  
  <p>CSV Output: for some reason both <code>fputcsv()</code> and <code>League-CSV</code> adds single quote and it works when i remove it.</p>
  
  <p><a href="https://i.stack.imgur.com/ZP3Sf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZP3Sf.jpg" alt="output of CSV file"></a></p>
  
  <p>output of Gedit:</p>
  
  <p><a href="https://i.stack.imgur.com/ET1RO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ET1RO.jpg" alt="output of Gedit"></a></p>