Results 1 to 4 of 4

Thread: Insert Query is not working with phpexcel Script

  1. #1
    Join Date
    Oct 2010

    Post Insert Query is not working with phpexcel Script

    I am using phpExcel library for import data from excel(csv) file into mysql data. Every thing is working fine except mysql insert query below is my source code. Please after review my codes let me know where is problem. I have tried with an array but im fail too. Please review my mysql query and let me know which query will be better in this PhpExcel Library. Thanks in advance.

    PHP Code:
    $objPHPExcel PHPExcel_IOFactory::load("myfile.csv");
    foreach (
    $objPHPExcel->getWorksheetIterator() as $worksheet) {

    $worksheetTitle     $worksheet->getTitle();
    $highestRow         $worksheet->getHighestRow();
    $highestColumn      $worksheet->getHighestColumn();
    $highestColumnIndex PHPExcel_Cell::columnIndexFromString($highestColumn);
    $nrColumns ord($highestColumn) - 64;

    for (
    $row=2$row<=$highestRow$row++) {
    $cell $worksheet->getCellByColumnAndRow(3$row)->getValue();

    mysql_query("INSERT INTO myTableName (`title`) VALUES ('$cell')");   


  2. #2
    Join Date
    Apr 2010
    Where is the rest of your mysql query? There is no connect nor a db select
    Never done it your way before though.

  3. #3
    Join Date
    Oct 2010

    thanks for your response. My problem has been resolved for insert data into database. But another problem has been occored. I have an excel file with field 'Description(May be more than 1000 characters in each cell)' including 248 rows right now. When i try to insert it into database table insert then first 92 lines executed into database. Can you assist me regard this matter why phpExcel is limiting this. In near future may be excel rows should be more than 50000. Please tell me how can i handle large files data. Thanks

  4. #4
    Join Date
    Oct 2010
    I got it. The description cell contains on html elements i.e{<table>, <p>, <b> font so on....}. Each excel cell is heavy therefore i need proper method which will deal with html. Is there any function or method in phpexcel that will handle this html cell data and take it from excel and insert into database from start to end? If yes please give me at least one example. Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center