How to read Excel sheet in row wise here we r having code for column wise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys here is our code for reading Excel sheet using php

<?php
 include  "config.php";
$filename = "D:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\sample\Senator.xls";
//$filename = "./Senator.xls";
$sheet1 = 1;
$arr=array(1=>'a','b','c','d','e');
$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 "file name is".$filename."<br>";
//$excel_app->Application->Visible = 1; #Make Excel visible.
$Workbook = $excel_app->Workbooks->Open($filename) or Die("Did not
open $filename $Workbook");
$Worksheet = $Workbook->Worksheets($sheet1);
echo "MALAYAPPA<br>";
$Worksheet->activate;
$excel_cell = $Worksheet->Range("C1");
$excel_cell->activate;
for($i=1; $i<=10;$i++)
{
for($j=1; $j<=10;$j++)
{
$excel_cell = $Worksheet->Range($arr[$i].$j);
echo "<br> The value is $arr[$i].$j => ". $excel_cell->value;

//$query="insert into
bulk_register(credits,username,firstname,lastname,email,mobile,city,password)values
()"


}
}

$excel_result = $excel_cell->value;

$Workbook->Close;
unset($Worksheet);
unset($Workbook);
$excel_app->Workbooks->Close();
$excel_app->Quit();
unset($excel_app);
?>

but weneed to read as row wise
plz tell some suggession
Thanks&regards
srinivaspmm 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux