The following section describes how to use the phpexcel class to import mysql databases to excel (instance code ). I think it is quite good. Now I will share it with you and give you a reference. Let's take a look at the phpexcel file. Address: 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 the specified file $ sheet = $ objPHPExcel-> getSheet (0); $ highestRow = $ sheet-> getHighestRow (); // get the total number of rows $ highestColumn = $ sheet-> getHighestColumn (); // get the total number of columns $ k = 0; // read the excel file cyclically and read one, insert a for ($ j = 2; $ j <= $ highestRow; $ j ++) {$ A = $ objPHPExcel-> getActiveSheet ()-> getCell ("". $ j)-> getValue (); // obtain the value of column A $ B = $ objPHPExcel-> getActiveSheet ()-> getCell ("B ". $ j)-> getValue (); // obtain the value of Column B $ SQL = "INSERT INTO table VALUES (". $. ",". $ B. ")"; mysql_query ($ SQL );}
In the above section, using phpexcel to import mysql databases (instance Code) is all the content that I have shared with you. I hope you can provide a reference and support for me.