csv to excel conversion

2019-01-13 18:27发布

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

4条回答
不美不萌又怎样
2楼-- · 2019-01-13 19:04

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...)

查看更多
该账号已被封号
3楼-- · 2019-01-13 19:16

Note: PHPExcel is now listed as DEPRECATED.

Users are directed to PhpSpreadsheet.

查看更多
甜甜的少女心
4楼-- · 2019-01-13 19:19

Using PHPExcel

include 'PHPExcel/IOFactory.php';

$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("\t");
// If the files uses an encoding other than UTF-8 or ASCII, then tell the reader
$objReader->setInputEncoding('UTF-16LE');

$objPHPExcel = $objReader->load('MyCSVFile.csv');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('MyExcelFile.xls');
查看更多
Emotional °昔
5楼-- · 2019-01-13 19:25

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/

查看更多
登录 后发表回答