Home >Backend Development >PHP Problem >How to convert excel to csv in php
php method to convert excel to csv: first open the corresponding PHP file; then use the "PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');" method to convert excel to csv.
Recommended: "PHP Video Tutorial"
1. Can php convert execl into csv
PHPExcel can completely meet your requirements. Here is a simple processing example. For details, you should read the PHPExcel documentation:
$filename = "myexcel.xlsx"; $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load($filename); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV'); $objWriter->save(str_replace('.xlsx', '.csv',$filename));
2.php export excel or csv
Output encoding and Supported formats 1. Supports common format csv text specifications, using spaces and newlines to identify commonly used ones: \t\n Filling blanks and newlines 2. Supports simple html codes and commonly used table specifications: table specifications, table merge specifications, font tags Norms
统计 111213 212223 =A1+A222SUM(A3:A4) php 输出excel 代码<?phpheader("Content-type:application/vnd.ms-excel");header("Content-Disposition:filename=excel.xls");echo "A1\t B1\t C1\n";echo "A2\t B2\t C2\n";echo "A3\t B3\t c3\n";?>利用\t来区分单元格利用\n来换行。
The above is the detailed content of How to convert excel to csv in php. For more information, please follow other related articles on the PHP Chinese website!