Reputation: 38190
I read here http://www.daniweb.com/code/snippet217293.html# it is possible.
What should be activated in PHP.Ini or elsewhere to make this work ? Are there any examples with Excel ?
Upvotes: 2
Views: 1918
Reputation: 1
what's your target? Import excel into a DB? You can use PHPExcelReader or dbTube.org for this task. Here you are.
PHP is platform independend. I think it is not a good idea to break this....in a long term of view.
greeting
NotALinuxMan
Upvotes: 0
Reputation: 2621
If you are running php on windows it will be installed by default. There are a few options you can set though. I don't believe they're needed:
http://www.php.net/manual/en/com.configuration.php
As for an example working with excel? Here's a little snippet I found for pulling out a value from an excel spreadsheet:
<?PHP
$filename = "c:/spreadhseet/test.xls";
$sheet1 = 1;
$sheet2 = "sheet2";
$excel_app = new COM("Excel.application") or Die ("Did not connect");
print "Application name: {$excel_app->Application->value}\n" ;
print "Loaded version: {$excel_app->Application->version}\n";
$Workbook = $excel_app->Workbooks->Open("$filename") or Die("Did not open $filename $Workbook");
$Worksheet = $Workbook->Worksheets($sheet1);
$Worksheet->activate;
$excel_cell = $Worksheet->Range("C4");
$excel_cell->activate;
$excel_result = $excel_cell->value;
print "$excel_result\n";
$Worksheet = $Workbook->Worksheets($sheet2);
$Worksheet->activate;
$excel_cell = $Worksheet->Range("C4");
$excel_cell->activate;
$excel_result = $excel_cell->value;
print "$excel_result\n";
#To close all instances of excel:
$Workbook->Close;
unset($Worksheet);
unset($Workbook);
$excel_app->Workbooks->Close();
$excel_app->Quit();
unset($excel_app);
?>
Upvotes: 3