I use a class that returns me the value of a specific row and cell of an Excel table. To create an array from a single column, I count the rows, and then iterate over this number with a loop for(), and then use $array[] = $valueto set the value of an increasing array object.
This works great if none of the values ββin the cell are 0. The class returns me the number 0, so it has nothing to do with the class, I think this is how I iterate over the rows and then assign them to the array ... I want to transfer the value 0, because I create graphs with the data afterwards, here is the code i have.
$rainfall = array();
for($i=1;$i<=$count;$i++)
{
if($data->val($i,2) != 'Rainfall')
{
$rainfall[] = $data->val($i,2);
}
}
For your information, it $datais an Excel spreadsheet object, and a method $data->val(row,col)is what returns the value to me. In this case, I get the data from the column 2.
Spreadsheet screenshot
source
share