//php file

$strSheetName = 'test';

$objXLApp = new COM( "excel.application" ) or die( "unable to start
MSExcel" );
$objXLApp->Workbooks->Open( "path/test.xls" );
$objXLSheet = $objXLApp->ActiveWorkBook->WorkSheets( $strSheetName );

$strCellName = 'B'.$i;
$objXLCell = $objXLSheet->Range( $strCellName);
echo $objXLCell->Value()."<br>";

echo $i;

//print $objXLCell->Value();
//print "Cell $strCellName in $strSheetName: \"" . $objXLCell->Value() .

// must do all of these to release resources correctly...

unset( $objXLCell );
unset( $objXLSheet );


unset( $objXLApp );

Hello, i m using this script for importing excel data into database.Here i have used my logic for exporting data from all columns.is there any function of COM using which we can iterate through until there is a record or we can specify the range?

Hello, i got 1 script to do above job.it is really good here you can specify from where to start and end.Here is the code.......

//always make sure path is coorect.because this is the which //causes the most of the problem.
$filename = "path";
$sheet1 = 1;

//specifying the alphabet column name

//if you want to specify 2 sheet then 
//$sheet2 = "sheet2";

$excel_app = new COM("Excel.application") or Die ("Did not connect");
//print "Application name: {$excel_app->Application->value}<br>\n" ;
//print "Loaded version: {$excel_app->Application->version}<br>\n";
//print $filename;
//$excel_app->Application->Visible = 1; #Make Excel visible.

//opening the file
$Workbook = $excel_app->Workbooks->Open($filename) or Die("Did not open $filename $Workbook");

//specifying the sheet to read
$Worksheet = $Workbook->Worksheets($sheet1);

//activating the file

for($j=3; $j<107;$j++)
	for($i=1; $i<5;$i++)
		$excel_cell = $Worksheet->Range($arr[$i].$j);
		echo "<br>The value is $arr[$i].$j => " . $excel_cell->value;
echo "<br>";

$excel_result = $excel_cell->value;