Jump to content

Reading data from excel file in php


anny

Recommended Posts

i download this file already but it does not work nothing is showing i dnt know y:(

plz help me

 

i put the folder(which contain excel reader) in htdocs & ,my script test.php like

C:\apache2triad\htdocs\ReadingEXCELfile\Excel\test.php

 

code is

 

<html>

<head><title></title>

  <body>

    <table>

    <?php

    // include class file

    include 'reader.php';

   

    // initialize reader object

    $excel = new Spreadsheet_Excel_Reader();

   

    // read spreadsheet data

    $excel->read('Book1.xlsx');   

   

    // iterate over spreadsheet cells and print as HTML table

    $x=1;

    while($x<=$excel->sheets[0]['numRows']) {

      echo "\t<tr>\n";

      $y=1;

      while($y<=$excel->sheets[0]['numCols']) {

        $cell = isset($excel->sheets[0]['cells'][$x][$y]) ? $excel->sheets[0]['cells'][$x][$y] : '';

        echo "\t\t<td>$cell</td>\n"; 

        $y++;

      } 

      echo "\t</tr>\n";

      $x++;

    }

    ?>   

    </table>

  </body>

  </head>

</html>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.