php - Find highest column in row PHPExcel -


i triying read columns excel file number variable depending on row. example: row1, col2, col3, col4 row2, col2,col3 row3,col2,col3,col4,col5,col6

i trying like:

for ($row = 1; $row < 2; $row++){     $rowdata = $sheet->rangetoarray('a' . $row . ':' . $highestcolumn . $row,                                     null,                                     true,                                     false);     echo print_r($rowdata[0][0]);     echo "<br>";     $list_of_coordinates = "";     $i = 1;     //echo print_r($rowdata[$row][$i+1]);     while($rowdata[0][$i+1] != ""){       /*$list_of_coordinates = $list_of_coordinates .                               "," .                              $rowdata[0][$i+1] .                               "," .                              $rowdata[0][$i];       */       $i+2;     }     $list_of_coordinates = ltrim($list_of_coordinates, ",");     echo $list_of_coordinates;     echo "<br>";   } 

but $highestcolumn has column number of maximum one, in file: bm. of rows have 3 or 4 columns. possible update number? while loop not working right now.

the gethighestcolumn() , gethighestdatacolumn() methods accept optional row number argument. if called without passing argument, return highest column number in worksheet; if called row number, return highest column in specified row.

however, alternative, use row , column iterators, existing cells (see 28iterator.php in /examples).


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -