The above section describes how to use php to export excel files. here is how to import excel files through php.
The above section describes how to use php to export an excel file. here we will share the method of importing an excel file through php:
File: http://pan.baidu.com/share/link? Consumer id = 1345826295 & uk = 2332350821
Code:
SetReadDataOnly (true); // read the demo.xls FILE $ phpExcel = $ Obj-> load (dirname (_ FILE __). '/output.xls'); // get the current activity sheet $ objWorksheet = $ phpExcel-> getActiveSheet (); // get the number of rows $ highestRow = $ objWorksheet-> getHighestRow (); // Obtain the number of columns $ highestColumn = $ objWorksheet-> getHighestColumn (); $ highestColumnIndex = PHPExcel_Cell: columnIndexFromString ($ highestColumn); // cyclically output data $ data = array (); for ($ row = 1; $ row <= $ highestRow; ++ $ row) {for ($ col = 0; $ col <$ highestColumnIndex; ++ $ col) {$ val = $ objWorksheet-> getCellByColumnAndRow ($ col, $ row)-> getValue (); $ data [$ row] [$ col] = trim ($ val) ;}} echo''; Print_r ($ data); echo'
';