Home >Backend Development >PHP Tutorial >php 能否查询excel表?

php 能否查询excel表?

WBOY
WBOYOriginal
2016-06-06 20:46:131611browse

使用php语言,能否把excel当成是table表那样进行查询,获取数据?

回复内容:

使用php语言,能否把excel当成是table表那样进行查询,获取数据?

PHPExcel

https://github.com/ouardisoft/OSExcelBundle

用法:

读取excel service

$excel = $this->get('os.excel');

打开excel

$excel->loadFile([FILE_PATHNAME]);

选择sheet

$excel->setActiveSheet([INDEX_OF_SHEET]);
sheet数

$excel->getSheetCount();
sheet名

$excel->getSheetNames();

读取行数

$excel->getRowCount();

读取字段数

$excel->getColumnCount();

最后一个字段的索引

$excel->getHighestColumn();

行数据

$excel->getRowData([INDEX_OF_ROW]);

单元格数据

$excel->getCellData([INDEX_OF_ROW], [INDEX_OF_COLUMN]);

把excel数据读取为PHP数组

$excel->getSheetData();

handle excel 的问题我推荐这个插件: PHPExcel

你指的查询是怎么样查询呢?由行列信息得值还是?

Statement:
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