Web/PHP

[PHP]Excel에서 Cell에 있는 value추출

ninanio3 2018. 1. 10. 00:32

$x=1;
  echo "\t<table >\n";
        while($x<=$data->sheets[0]['numRows']) {  // reading row by row
          echo "\t<tr>\n";
          $y=1;
          while($y<=$data->sheets[0]['numCols']) {  // reading column by column
            $cell = isset($data->sheets[0]['cells'][$x][$y]) ? $data->sheets[0]['cells'][$x][$y] : '';
            if($x == 1) {echo "\t\t<td>$cell</td>\n";}  // get each cells values
            $y++;
          } 
          echo "\t</tr>\n";
          $x++;
        }
  echo "\t</table>\n";