phpExcel 下载地址:http://phpexcel.codeplex.com/
<?php /** PHPExcel_IOFactory */ require_once DEDEINC. '/Classes/PHPExcel/IOFactory.php'; $resource= $importPath.'/'.$filename; if (!file_exists($resource)) { exit("$resource is not exists./n"); } $objPHPExcel = PHPExcel_IOFactory::load($resource); $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); //echo $highestRow;echo '=='; //echo $highestColumn; //echo '
'; $arr= array(0=>'A', 1=>'B', 2=>'C', 3=>'D', 4=>'E', 5=>'F', 6=>'G', 7=>'H', 8=>'I', 9=>'J', 10=>'K', 11=>'L', 12=>'M', 13=>'N', 14=>'O', 15=>'P', 16=>'Q', 17=>'R', 18=>'S', 19=>'T', 20=>'U', 21=>'V', 22=>'W', 23=>'X', 24=>'Y', 25=>'Z' ); //header("Content-Type:text/html;charset=utf-8"); //getCellByColumnAndRow(0,2) 列(从0开始),行(从1 开始) //echo $sheet->getCellByColumnAndRow(0,2)->getValue(); //echo '=============';每次读取一行,一行为一条记录 $cycleIndex = $highestRow+1; $j=0; //记录导入成功的数目 for($row=2;$row<=$highestRow;$row++){ for($column=0;$arr[$column]!='E';$column++){ $val= trim($sheet->getCellByColumnAndRow($column,$row)->getValue()); } }