Bonjour,
Je voudrais savoir comment faire pour convertir un ensemble de fichiers CSV contenu dans un répertoire en xls. Si possible aussi de changer l'encodage.
Merci d'avance
foreach ( $files as $file ) {
$objReader = PHPExcel_IOFactory::createReader ( 'CSV' );
// If the files uses a delimiter other than a comma (e.g. a tab), then tell the reader
$objReader->setDelimiter ( ";" );
// If the files uses an encoding other than UTF-8 or ASCII, then tell the reader
$objReader->setInputEncoding ( 'UTF-8' );
$objPHPExcel = $objReader->load ( $file );
$objWriter = PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' );
$objWriter->save ( dirname ( __FILE__ ) . '/archive/' . basename ( $file ) . '.ods' );
echo 'file created';
}