Home > Backend Development > PHP Tutorial > 请问Spreadsheet_Excel_Reader 怎么读取excel指定的工作簿?

请问Spreadsheet_Excel_Reader 怎么读取excel指定的工作簿?

WBOY
Release: 2016-06-23 13:51:08
Original
1187 people have browsed it

$data = new Spreadsheet_Excel_Reader();$data->setOutputEncoding('gbk');$data->read('abc.xls'); echo $data->sheets[0]['cells'][1][1];
Copy after login


sheets[0]代表第一个工作簿,请问如果指定读取excel 中一个叫water的工作簿的第一行、 第一列的数据,代码该怎么写?


回复讨论(解决方案)

遍历sheet 取title = water的sheet的key值

4年前弄过php , 基本忘光了,能不能直接给下代码?

没有用过这个玩意,或许你可把他放到云盘上

有弄过的吗? 给个代码

研究了一下午,按forain2012说的遍历了sheet表,可以指定表明了,就不知道还有没有什么简单方法.

require_once 'phpExcelReader/Excel/reader.php';$data =new Spreadsheet_Excel_Reader();$data->setOutputEncoding('gbk');$data->read('物业.xls'); $sheet_name='排水';for($sheet=0;$sheet<count($data->sheets);$sheet++){ 	if($data->boundsheets[$sheet]['name']==$sheet_name){		break;	}}echo $data->sheets[$sheet]['cells'][1][1];
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template