how to import data from excel to mysql using php

in this tutorial you will learn how to import data from excel to mysql using php – import excel file into mysql database tutorial. We always require to add/updated or delete data from php admin panel like employee, products, items, users, emails etc.

how to import data from excel to mysql using php

simply step by step Import Excel File into MySQL Database using PHP.

Step 1.Download Package

We have to use a third-party library that can read Excel files first of all Click Here to download PHP Excel. and then simply this download extract it to your main folder and rename it to “library”.

Don’t Miss : Import Data From Excel To Mysql Using Php Code

2.Create db_config.php file

db_config.php


3.Create index.php file




	Excel Uploading PHP - www.pakainfo.com
	




Excel Upload

Download Example File from here : Example.ods

4.Create doFlUpl.php

sheets());
    echo "You have total ".$totalSheet." sheets".
    $html="";
    $html.="";

    for($i=0;$i<$totalSheet;$i++){
      $Reader->ChangeSheet($i);
      foreach ($Reader as $Row)
      {
        $html.="";
        $title = isset($Row[0]) ? $Row[0] : '';
        $description = isset($Row[1]) ? $Row[1] : '';
        $html.="";
        $html.="";
        $html.="";
        $query = "insert into items(title,description) values('".$title."','".$description."')";
        $mysqli->query($query);
       }
    }
    $html.="
TitleDescription
".$title."".$description."
"; echo $html; echo "
Data Inserted in dababase"; }else { die("
Sorry, File type is not allowed. Only Excel file."); } } ?>

How to Import Excel File into Mysql Database Table in PHP?

index.php





Only Excel/CSV File Import.

how to import data from excel to mysql using php

Leave a Comment