This article introduces a simple example of php reading excel files. For more information, see
This article introduces a simple example of php reading excel files. For more information, see
The Code is as follows:
$ This-> loadexcel (); // semi-complete phpexcel File
$ _ ReadExcel = new PHPExcel_Reader_Excel2007 ();
If (! $ _ ReadExcel-> canRead('link.xls ')){
$ _ ReadExcel = new PHPExcel_Reader_Excel5 ();
}
$ _ PhpExcel =$ _ ReadExcel-> load('link.xls ');
$ SheetCount = $ _ phpExcel-> getSheetCount ();
$ NewExcel = array ();
$ ExcelData = array ();
For ($ s = 0; $ s <$ sheetCount; $ s ++ ){
$ CurrentSheet =$ _ phpExcel-> getSheet ($ s );
$ AllColumn = $ currentSheet-> getHighestColumn ();
$ AllRow = $ currentSheet-> getHighestRow ();
For ($ r = 1; $ r <= $ allRow; $ r ++ ){
For ($ currentColumn = 'a'; $ currentColumn <= $ allColumn; $ currentColumn ++ ){
$ Address = $ currentColumn. $ r;
$ NewExcel [] = $ currentSheet-> getCell ($ address)-> getValue ();
}
}
}
Next is the operation on the array-but you need to download phpexcel, the Hong Kong virtual host, and include
, Hong Kong server, Hong Kong Space