how to upload excel file in php?

Today, We want to share with you how to upload excel file in php.In this post we will show you how to import xlsx file into mysql database using php?, hear for how to display excel file in php we will give you demo and example for implement.In this post, we will learn about Import Excel File Data In Database Using PHP with an example.

How to upload excel file to php server from

?

Example 1: index.php





Only Excel/CSV File Import.

PHP – import excel file into mysql database tutorial

db_config.php


Create index.php file




	Excel Uploading PHP - www.pakainfo.com
	




Excel Upload

Download Demo File from here : Demo.ods

Create excelUpload.php file

sheets());


    echo "You have total ".$totalSheet." sheets".


    $html="";
    $html.="";

    for($i=0;$i<$totalSheet;$i++){


      $Reader->ChangeSheet($i);


      foreach ($Reader as $product)
      {
        $html.="";
        $title = isset($product[0]) ? $product[0] : '';
        $description = isset($product[1]) ? $product[1] : '';
        $html.="";
        $html.="";
        $html.="";


        $query = "insert into products(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."); } } ?>

I hope you get an idea about How to Import Excel File into Mysql Database Table in PHP?.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment