Download the phpexcel file at phpexcel.codeplex.com/
Sample Code
Require_once 'phpexcel/Classes/phpexcel. php ';
Require_once 'phpexcel/Classes/phpexcel/IOFactory. php ';
Require_once 'phpexcel/Classes/phpexcel/Reader/excel5.php ';
$ ObjReader = PHPExcel_IOFactory: createReader ('excel5'); // use excel2007 for 2007 format
$ ObjPHPExcel = $ objReader-> load ($ filename); // $ filename can be an uploaded file or a specified file
$ Sheet = $ objPHPExcel-> getSheet (0 );
$ HighestRow = $ sheet-> getHighestRow (); // gets the total number of rows.
$ HighestColumn = $ sheet-> getHighestColumn (); // gets the total number of Columns
$ K = 0;
// Read the excel file cyclically, read one, and insert one
For ($ j = 2; $ j <= $ highestRow; $ j ++)
{
$ A = $ objPHPExcel-> getActiveSheet ()-> getCell ("A". $ j)-> getValue (); // obtain the value of column
$ B = $ objPHPExcel-> getActiveSheet ()-> getCell ("B". $ j)-> getValue (); // obtain the value of Column B
$ SQL = "insert into table VALUES (". $ a. ",". $ B .")";
Mysql_query ($ SQL );
}