I am trying to use PHP to create a comma seperated value file from an excel file. I can open the excel file and save it back to the server but I have not been able to change the file format to csv.
This is the code I am using
<?php
echo "Opening Excel...";
// create an object instance
$excel = new COM("Excel.Application") or die("Excel could not be
started");
// pop open the Excel application
$excel->Visible = 0;
// turn off alerts
$excel->DisplayAlerts = 0;
// add a workbook
echo "<br>Open Excel File...";
//echo com_get($excel, FileFormat);
//c:\documents and settings\all users\documents\htdocs\forsale\foreclosure
$excel->Workbooks->open("c:\documents and settings\all users\documents\htdocs\forsale\forclosure\pnwlist.xls");
// save
echo "<br>Saving CSV File...";
/ This is the line that doesn't work /
$excel->Workbooks[1]->SaveAs.FileFormat=="xlCSV"; //, "FileFormat:=xlCSV"
$excel->Workbooks[1]->SaveAs("C:\pnwlist.csv");
// close the application
echo "<br>Quiting Excel...";
$excel->Quit();
echo "<br>Clear Memeory Excel...";
$excel = null;
?>