Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert .xlsx file to .csv file using PHP

I'm looking for a low overhead way to convert a .xlsx file to a .csv file using PHP without consuming excess memory or loading extraneous classes. Anyone?

like image 441
Avigayil Avatar asked Aug 01 '11 08:08

Avigayil


People also ask

How do I create a CSV file in PHP?

To convert an array into a CSV file we can use fputcsv() function. The fputcsv() function is used to format a line as CSV (comma separated values) file and writes it to an open file.

How can I open XLSX file in PHP?

Read an Excel File (XLSX)​ Open the XSLX file with $reader->open($path) Browse each Sheet of the spreadsheet with $reader->getSheetIterator() Browse each Row of the Sheet with $sheet->getRowIterator() Browse each Cell of the Row with $row->getCells()


1 Answers

You can read XLSX files with PHP using PhpSpreadsheet. From there, you only need to figure out the destination format.

like image 187
sbrattla Avatar answered Sep 16 '22 12:09

sbrattla