Phpexcel Simple Read Excel file example,
This article describes the Phpexcel simple way to read Excel files. Share to everyone for your reference, as follows:
PHP Excel Classes
Project providing a set of classes for the PHP programming language, which "allow" to "write to" and "read from different F" Ile formats, like Excel, PDF, HTML, ... This is built around Microsoft's OpenXML standard and PHP.
Download Address:
http://phpexcel.codeplex.com/
Read an Excel file to get an example of the contents of each column in each row:
set_include_path (Get_include_path (). Path_separator. './classes/'); include ' phpexcel/iofactory.php '; $reader = Phpexcel_iofactory::createreader (' Excel2007 '); Read Excel Document $phpexcel = $reader->load ($excelfilename); Document name $sheet = $PHPExcel->getsheet (0); Reads the first worksheet (numbering starts at 0) $highestRow = $sheet->gethighestrow (); Total number of rows $highestcolumn = $sheet->gethighestcolumn (); Total number of columns obtained $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 ');//echo $highestRow. $highestColumn; /read a column for ($row = 5; $row <= $highestRow; $row + +) {for ($column = 0; $arr [$column]! = ' T '; $column + +) {$val = $ Sheet->getcellbycolumnandrow ($column, $row)->getvalue (); Echo $val; }}
Add: small make up here to recommend a site of the PHP format beautification of the layout tools to help you in the future of PHP programming code layout:
PHP Code online format Beautification tool:
Http://tools.jb51.net/code/phpformat
In addition, because PHP is a C language style, the following tool can also be used to implement the PHP code format:
C Language Style/html/css/json code formatting beautification tool:
Http://tools.jb51.net/code/ccode_html_css_json
More readers interested in PHP related content can view this site topic: "PHP Operations Office Document Skills Summary (including word,excel,access,ppt)", "PHP array" operation Skills Daquan, "PHP Sorting algorithm Summary", " PHP common traversal algorithm and skills summary, "PHP Data structure and algorithm tutorial", "PHP Programming Algorithm Summary", "PHP Math Skills Summary", "PHP Regular Expression Usage summary", "PHP operation and operator Usage Summary", "PHP String Usage Summary" and "PHP Common database Operation Skills Summary"
I hope this article is helpful to you in PHP programming.
http://www.bkjia.com/PHPjc/1133074.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133074.html techarticle Phpexcel A simple example of reading an Excel file, this article describes the Phpexcel simple way to read an Excel file. Share to everyone for your reference, specifically as follows: PHP Excel classes Pro ...