Link to home
Start Free TrialLog in
Avatar of fastfind1
fastfind1

asked on

Convert XLS to CSV using PHP on Linux Apache server

I have an exisitng web app written in PHP, that allows the user to upload a csv file and it imports the data into a mysql table.

My client is now complaining about converting xls files to csv.  Is there a script or linux program that I can run on the server that would convert the excel spreadsheet to csv on the web server?

Then my client could just upload the xls files and be done with it?

What about a linux based conversion of xlsx files to csv??
Avatar of fastfind1
fastfind1

ASKER

I have found on source_forge something called Spreadsheet_Excel_Reader.  I tried the following code to try and get a csv file to pop out from the xls file, but it is not working.  Can anyone see the error in my code?
<?php
 
require_once 'reader.php';
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read('closing/closing.xls');
 
?>

Open in new window

Avatar of Steve Bink
The Spreadsheet_Excel_Reader class is not well-documented.  In fact, I could find no documentation for it at all.  But I believe it only reads an Excel file.

What error are you receiving with your code?
No error - but no result.

Maybe Spreadsheet_Excel_reader is not what I want.

Anyone have a solution for converting xls files to csv files on a linux server - using a PHP script, or something similar?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial