您的位置:首页 > 编程语言 > PHP开发

phpexcel 读取数据

2016-10-22 04:12 204 查看
http://extjs.org.cn/fatjames/archives/379

require_once '/home/PHPExcel_1.8.0/PHPExcel/IOFactory.php';

$reader = PHPExcel_IOFactory::createReader('Excel2007'); //设置以Excel5格式(Excel97-2003工作簿)
$PHPExcel = $reader->load("/home/all.xlsx"); // 载入excel文件
$sheet = $PHPExcel->getSheet(0); // 读取第一個工作表
$highestRow = $sheet->getHighestRow(); // 取得总行数
$highestColumm = $sheet->getHighestColumn(); // 取得总列数

/** 循环读取每个单元格的数据 */
for ($row = 2; $row <= $highestRow; $row++){//行数是以第1行开始
for ($column = 'A'; $column <= $highestColumm; $column++) {//列数是以A列开始
$dataset[] = $sheet->getCell($column.$row)->getValue();
//echo $column.$row.":".$sheet->getCell($column.$row)->getValue()."<br />";
echo $sheet->getCell($column.$row)->getValue()."  ";
}
exit('!');
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: