|
Posted by Hemanth on 11/04/05 02:26
Hello there,
I'm trying to read an excel worksheet (with more than 5000 rows and 30
columns) using PHP. I'm using the "excelreader" script I found over the
web - http://sourceforge.net/projects/phpexcelreader/.
Seems to me, the script reads the values in all cells correctly and
stores the total number of rows and columns existing in the worksheet
(For example, in the excel file I'm using - total rows: 5375 and cols:
37). The problem is when I try to print the values as a HTML table
(using two for loops), the script prints only first 236 rows and stops
execution. The following is the code snippet I use:
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++)
{
echo "<TR>";
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++)
{
echo "<TD>".$data->sheets[0]['cells'][$i][$j];
}
echo "<BR>";
}
I've also set the script execution time to 5-10 mins using
"set_time_limit" function, but the script still ends after printing 236
rows (takes less than a minute). I spot checked the cell values by
printing values from 300 to 500, 5200 to 5375 etc. The values seems to
okay and stored correctly in the arrays. From what I understood, the
for loops doesn't execute completely and I don't understand why?
I've also created a small test script to see if the loops work and the
following code breaks...I don't see a output.
<?php
set_time_limit(300);
for ($i = 1; $i <= 5000; $i++)
{
for($j = 1; $j <= 40; $j++)
{
$data[$i][$j] = "mycell - $i$j"; //. ($i * $j);
}
}
echo "PRINTING TABLE....<BR>";
echo "<table border='1'>";
for ($i = 1; $i <= 1000; $i++)
{
echo "<TR><TD>[$i]";
for($j = 1; $j <= 20; $j++)
{
echo "<TD>". $data[$i][$j];
}
echo "<BR>";
}
echo "</table>";
?>
Can anyone throw some light on it. Appreciate your help.
TIA,
Hemanth
P.S: I'm using IE5.5, PHP4.1.2, Firefox1.0.4
Navigation:
[Reply to this message]
|