Description
PDOModel 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" |
Examples
$pdomodel = new PDOModel(); //create object of the PDOModel class
/* excel to array function */
$records = $pdomodel->excelToArray("emp.xls");
More Examples
//Example 2
$records = $pdomodel->excelToArray("emp.xls");
$pdomodel->insertBatch("emp", $records);
Result/Output
Record will be inserted in database
Debug
| Option | Details | Example |
|---|---|---|
| print_r($pdomodel->error) | Print errors (if any) |