Reputation: 51951
Is there an existing PHP module to convert UTF-8 encoded .csv
to an Excel .xls
file? Thanks
Upvotes: 1
Views: 2244
Reputation: 212522
Look at using a library such as PHPExcel, which can read spreadsheets in a variety of formats (including CSV) and write to Excel .xls or .xlsx files.
include 'PHPExcel/IOFactory.php';
$inputFileType = 'CSV';
$inputFileName = 'inputFile.csv';
$outputFileType = 'Excel5';
$outputFileName = 'outputFile.xls';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $outputFileType);
$objWriter->save($outputFileName);
Upvotes: 2
Reputation: 1059
Here is how to do it in PHP http://www.westwideweb.com/wp/2009/01/12/convert-csv-to-xls-excel-in-php/
Upvotes: 0