PDO Import Function - Excel Import import data from excel directly using GOModel helper functions


GOModel import from excel functions allows to import data from excel by passing excel file. File name and database table name needs to be passed in function. With the help of this you can insert record in database by calling insert or insertBatch function.

Function Defination

                                void function excelToArray($fileName) ;

Parameters Details

Details Type Example
$fileName - Name or path of excel file string file name like "xyz.xls" or "upload/xyz.xls"


                                $GOModel = new GOModel(); //create object of the GOModel class
                                /* excel to array function */
                                $records = $GOModel->excelToArray("emp.xls");

More Examples

                                //Example 2
                                $records = $GOModel->excelToArray("emp.xls");
                                $GOModel->insertBatch("emp", $records);



Record will be inserted in database


Option Details Example
print_r($GOModel->error) Print errors (if any)