Import Data From Excel To Mysql

hello friends In my project i need to import data from ms excel file to mysql database suggest any extensions,tutorials and your ideas for doing the same. Thank you…

I recently had a task to import spreadsheet data to a database. The submitted spreadsheets included csv, xls, and xlsx files. Some of the fields were values from external keys.

I solved the problem by executing a 254-line perl script.

oh here. in my project I need to import data from excel file. based on the user wish the database rows are created or updated. do you know any extension or idea richmest?

After uploading the user file into $filePath, I used the command

$out=shell_exec("./ $filPath $uID");

to do the actual importing. The $uID parameter is the user email for sending a summary report to the user. The $out variable allows yii to display the error messages (if any) that the perl script generates.

The perl script has the following functions:


[*]split the spreadsheet row into variables

[*]check fields for validity

[*]lookup indexes for external keys (the users supply values as names)

[*]if the ID field is blank add the row

[*]if the ID field has a value, update that row (check that the row exists first)

[*]email results to the user


The script was heavily customized, since it handles the fields of the database by name and handles the external keys individually.

Just ask your users to store excel as csv, and then

ini_set("auto_detect_line_endings", true); // otherwise you can get some problems for macs

if (($f = fopen($uploaded_file, "r")) !== false) {

    while (($data = fgetcsv($f, null, $separator)) !== false) {...}


Is any Yii related extension available.? if please share.

earlier i used php script to upload file.

Hi. i did this jobs by using excel library by placing it in my root directory.

Simply changed the directory and assign the tempname to the method to import

for export simply createSpreadsheet did my job.

Thing is i want to move the directory to extension or else anywhere in the protected folder.

please suggest me a solution so that i can make files secure.