Here to the Phpexcel class do not introduce, interested friends can consult their own information
There is a phpexcel.php file under the Classes folder, which is the main entry file for this class library, which is introduced before use.
Other classes, which are automatically loaded in this class
1 //set up reader objects to read 2007 and 2003 versions of Excel files with two different class objects respectively2 $PHPReader=Newphpexcel_reader_excel2007 ();3 if( !$PHPReader->canread ($filePath))4 {5 $PHPReader=NewPhpexcel_reader_excel5 ();6 if( !$PHPReader->canread ($filePath)){7 Echo' No Excel ';8 return ;9 }Ten } One A $PHPExcel=$PHPReader->load ($filePath); Read File - $currentSheet=$PHPExcel->getsheet (0);//Read the first workbook - $allColumn=$currentSheet->gethighestcolumn ();//of all Columns the $allRow=$currentSheet->gethighestrow ();//All line Numbers - - $data=Array();///The following is the reading of the contents of the column you want to get - for($rowIndex= 2;$rowIndex<=$allRow;$rowIndex++) + { - $data[] =Array( +' id ' =$cell=$currentSheet->getcell (' A '.$rowIndex)->getvalue (), A' Score ' =$cell=$currentSheet->getcell (' H '.$rowIndex)->getvalue (), at' Ranking ' =$cell=$currentSheet->getcell (' I ').$rowIndex)->getvalue (), - ); -}
Reading the contents of an Excel file with the Phpexcel class