PHP Classes

shit

Recommend this page to a friend!

      Convert CSV to Excel  >  All threads  >  shit  >  (Un) Subscribe thread alerts  
Subject:shit
Summary:help
Messages:1
Author:Lucas Giordano
Date:2014-11-11 19:38:39
 

  1. shit   Reply   Report abuse  
Picture of Lucas Giordano Lucas Giordano - 2014-11-11 19:38:40
This shit doesnt works, just use this

<?php

require_once('PHPExcel.php');

class CSVToExcelConverter
{
public static function convert($csv_file, $xls_file, $delimiter=",", $csv_enc=null) {

$objReader = PHPExcel_IOFactory::createReader('CSV');

$objReader->setDelimiter($delimiter);

if($csv_enc){
$objReader->setInputEncoding($csv_enc);
}

$objPHPExcel = $objReader->load($csv_file);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save($xls_file);
}
}