第一,在前台html页面进行上传文件:如:
复制代码代码如下:
下载一个phpexcel,当前大概是1.7.6版本
例子:
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
set_time_limit(1200); //20分钟
date_default_timezone_set('Europe/London');
require_once '../176/Classes/PHPExcel.php';
require_once '../176/Classes/PHPExcel/IOFactory.php';
$objReader = new PHPExcel_Reader_Excel5();
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load("../a.xls");
$sheet = $objPHPExcel->getSheet(0); //打开sheet0 序号从0开始
$highestRow = $sheet->getHighestRow(); //得到行数
$highestColumn = $objWorksheet->getHighestColumn(); //
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
//echo '总行数'.$highestRow;
$abiao=array();
for ($row = 1; $row <= $highestRow; ++$row) {
for ($col = 0; $col <= $highestColumnIndex; ++$col) {
$abiao[$row][$col]=$sheet->getCellByColumnAndRow($col, $row)->getValue();
}
}
//以上把表sheet0取到了$abiao这个数组中
//保存
//$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
//$objWriter->save("../aa.xls");
用客户端 读excel文件,然后传数据
vbscript和javascript都可以实现,excel.application
没有必要这样麻烦的,你用phpexcel实现吧