您好,欢迎访问一九零五行业门户网

phpexcel读取excel文件的方法

$reader = phpexcel_iofactory::createreader('excel5'); // 读取 excel 文件方式 此方法是读取excel2007之前的版本 excel2007 为读取2007以后的版本 也可以查\classes\phpexcel\reader 文件夹中的类(为所有读取类,需要哪个填上哪个就行)$phpexcel = $reader->load(info.xls); // 文件名称$sheet = $phpexcel->getsheet(0); // 读取第一个工作表从0读起$highestrow = $sheet->gethighestrow(); // 取得总行数$highestcolumn = $sheet->gethighestcolumn(); // 取得总列数// 根据自己的数据表的大小修改$arr = array(1=>'a',2=>'b',3=>'c',4=>'d',5=>'e',6=>'f',7=>'g',8=>'h',9=>'i',10=>'j',11=>'k',12=>'l',13=>'m', 14=>'n',15=>'o',16=>'p',17=>'q',18=>'r',19=>'s',20=>'t',21=>'u',22=>'v',23=>'w',24=>'x',25=>'y',26=>'z'); // 每次读取一行,再在行中循环每列的数值for ($row = 5; $row for ($column = 1; $arr[$column] != 't'; $column++) { $val = $sheet->getcellbycolumnandrow($column, $row)->getvalue(); $list[$row][] = $val; }} print_r($list);
复制代码
其它类似信息

推荐信息