How to convert excel to csv in php

藏色散人
Release: 2023-03-05 08:16:01
Original
3728 people have browsed it

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.

How to convert excel to csv in php

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));
Copy after login

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来换行。
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!