Forum


Replies: 1   Views: 17
How to convert an xlsx file to csv ?

Posted by Elisee9571  · 10-04-2025 - 08:54

I am using the version 4 of phpxlsx with the bureau licence.

We are using namespaces package.

We are using php version 8.3.

Here is an extract from the code :

$file = $request->files->get('file');
if (!$file) {
   return new Response("Aucun fichier uploadé.", Response::HTTP_BAD_REQUEST);
}

$filePath = $file->getRealPath();

Is it possible to read an imported xlsx file and export it as a csv file?

I would like the CSV file to be encoded in UTF-8 and separated by semicolons (;).

 

Posted by admin  · 10-04-2025 - 09:35

Hello,

The current stable release of phpxlsx can import a CSV using addCsv, but there's no method to export an XLSX to CSV. We have added a task to be included in the next stable release of phpxlsx.

Regards.