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交织定位能够读取单元格的数据
引荐教程:PHP视频教程
以上就是php怎样读取excel中的数据的细致内容,更多请关注ki4网别的相干文章!