PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.2k forks source link

loading CSV files with tab seperator #1248

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello,

i m using this code to load my csv files, but my csv files have tab seperator, can u please explain me how change the seperator default

// Chargement du fichier Excel
$objPHPExcel = PHPExcel_IOFactory::load("files.csv");

/**
* récupération de la première feuille du fichier Excel
* @var PHPExcel_Worksheet $sheet
*/
$sheet = $objPHPExcel->getSheet(0);

echo '<table border="1">';

// On boucle sur les lignes
foreach($sheet->getRowIterator() as $row) {

   echo '<tr>';

   // On boucle sur les cellule de la ligne
   foreach ($row->getCellIterator() as $cell) {
      echo '<td>';
      print_r($cell->getValue());
      echo '</td>';
   }

   echo '</tr>';
}
echo '</table>';

thanks

PowerKiKi commented 7 years ago

http://phpspreadsheet.readthedocs.io/en/develop/topics/reading-and-writing-to-file/#setting-csv-options