代码没有
只有思路
在php中调用com对象Excel.Application读取excel文件,循环读出每一行,再把每一行的各列写入mysql

解决方案 »

  1.   

    同意樓上所說,我想在php中只在些方法了,還有如果你會在 php 中用 ado 你可以用它一試,我沒試過只是有此想法而已!
      

  2.   

    你只是要把Excel的数据转移到mysql而已吧,一把该文件设置为ODBC,然后怎么了........二是把Excel保存为txt格式,然后另行处理........
      

  3.   

    PHP生成名为test.xls的EXCEL代码如下:
    <?header("Content-type:application/vnd.ms-excel");header("Content-Disposition:filename=test.xls");echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";?>
      

  4.   

    至于反过来如何做,我再考虑一下,GZ!UP!!
      

  5.   

    $conn=odbc_connect('ask4job','','',SQL_CUR_USE_ODBC);
    首先,把excel文件建立一个odbc连接,执行下面的程序
    $query = "SELECT * FROM tbl_name";
    $result = odbc_exec($conn, $query) or die('Select failed!');
    $i = 0;
    echo $fCount = odbc_num_fields($result);
    while (odbc_fetch_row($result))
    {
      while ($i < $fCount)
      {
        $i++;
        echo $fName = odbc_field_name($result, $i);
        echo $fType = odbc_field_type($result, $i);
        echo $job[$fName] = odbc_result($result, $i);
      }
    }