James Johnson wrote:
I'd like to be able to read a microsoft spreadsheet with php. I know
that php can read mysql, so I was thinking that maybe it could read
excel spreadsheets as well.
Does anyone know if that can be done?
Jim
You could do this if you have MS Excel installed on the target machine,
using PHP support for COM.
<?php
$strSheetName = 'Sheet1'
$strCellName = 'A1';
$objXLApp = new COM( "excel.application" ) or die( "unable to start
MSExcel" );
$objXLApp->Workbooks->Open( "c:\\temp\\test.xls" );
$objXLSheet = $objXLApp->ActiveWorkBook->WorkSheets( $strSheetName );
$objXLCell = $objXLSheet->Range( $strCellName );
print "Cell $strCellName in $strSheetName: \"" . $objXLCell->Value() .
"\"\n";
// must do all of these to release resources correctly...
unset( $objXLCell );
unset( $objXLSheet );
$objXLApp->ActiveWorkBook->Close();
$objXLApp->Quit();
unset( $objXLApp );
?>
---
Steve