1、搭建php程序运行环境来执行程序,只要能让程序运行起来就行。
2、下载PHPExcel.php类文件以及相关组件
3、包含到要运行的文件中 require PHPExcel.php,创建对象默认用excel2007读取excel,若格式不对,则用之前的版本进行读取
4、读取excel的工作表可以是多个,如果你只需要读取第一个那么就用$PHPExcel->getSheet(0) , 如果是多个就在循环中进行操作其他内容
5、分别获取 excel表的行和列$allColumn = $currentSheet->getHighestColumn();/**取得一共有多少行*/$allRow = $currentSheet->getHighestRow();/**从第二行开始输出,因为excel表中第一行为列名*/
6、在行和列的双循环中来读取对应的数据for($currentRow = 2;$currentRow <= 98;$currentRow++){/**从第A列开始输出*/echo"<tr>";//for($currentColumn= 'A';$currentColumn<= $allColumn; $currentColumn++){$cancername="";for($currentColumn= 'A';$currentColumn<='B'; $currentColumn++){两个for交叉定位可以读取单元格的数据
7、我的操作后读出的结果希望能够帮助有需要的朋友