views:

58

answers:

4

Is there a way to convert csv file to excel file upon request through apache/.htaccess

A: 

Softinterface has a product that can batch-convert CSV to XLS files. There is a free download.

I found it by googling for convert csv to xls -- it was one of the 1.8 million hits.

(I'm not associated with Softinterface in any way, and haven't used this.)


Sorry, just noticed the Linux tag, and the above is a Windows program.

OpenOffice can convert CSV to XLS and can be scripted.

I found this "PyODConverter" script on OOONinja.

Stephen P
A: 

Yes, since apache is open-source, you can modify the .htaccess parser to call a library to convert your CSV files into excel files. But I don't think this is what you're looking for. :-).

I think really what you need is a dynamic web site. Then you can use PHP or any supported language to do what you need to do.

something like this: http://www.westwideweb.com/wp/2009/01/12/convert-csv-to-xls-excel-in-php/

Gary
+3  A: 

Using PHPExcel

include 'PHPExcel/IOFactory.php';

$objReader = PHPExcel_IOFactory::createReader('CSV');
$objPHPExcel = $objReader->load('MyCSVFile.csv');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('MyExcelFile.xls');
Mark Baker
A: 

There is a project in sourceforge that does this conversion:

http://sourceforge.net/projects/py-csv2xls/

But for the conversion you need to make a dynamic page in apache (in python, php...)

Pablo Alba