Start New Discussion within our Web Development Community

good evening people,i'm creating an application where i'd like to import and save a list of people in an excel sheet to my database in mysql, using php, And i'd like to modify it through a form using php!
Can anyone have an idea or something which will help me to solve my problem?
thank you!

I use this for importing. With respect to modifying it in PHP, that's just some standard code that you'll have to write. If the modifications are on a record-by-record basis, then you just populate the form with values from the DB and save the result. If you want to display multiple records in a spreadsheet-like grid, then you should look into JQuery code that can do that.

thanks, but this one uses only xls, is there another one which uses xlsx(2010)?

hello, i found out a way to import, using the PHPExcel classes, and i think it may be helpful for other who would like to use it and to modify it in order to make it perfect , here is the code!

    // here is the function which will help us to call the PHPExcel classe in our pages, you can put it in a file apart.
        $chemin = '/opt/lampp/htdocs/www/Classes/';
        set_include_path(get_include_path() . PATH_SEPARATOR . $chemin);//we specify the path" using linux"

        function __autoload($classe)
            $fichier = str_replace
            ) . '.php' ;

        $fichierACharger = 'listeglsi.xlsx';//the worksheets to use

                $fichierType = PHPExcel_IOFactory::identify($fichierACharger);

                $objetALire = PHPExcel_IOFactory::createReader($fichierType);

                $objPHPExcel = $objetALire->load($fichierACharger);
                //echo '<script>alert("le fichier a été chargé avec succes !");</script>';
                $feuille = $objPHPExcel->getSheet(0);//we specify the sheet to use

                $highestRow = $feuille->getHighestRow();//we select all the rows used in the sheet 

                $highestCol = $feuille->getHighestColumn();// we select all the columns used in the sheet

                $indexCol = PHPExcel_Cell::columnIndexFromString($highestCol);we set an index on the columns
                //we show the data through a table
                for($row = 9;$row <= $highestRow;$row++)
                    for($col = 1;$col <= $indexCol ;$col++)
                        $classeur = $feuille->getCellByColumnAndRow($col,$row)->getValue();

                //connection to the database

                //importing files to the database
                for($row = 9;$row <= $highestRow;$row++)
                    $mat = $feuille->getCellByColumnAndRow(1,$row)->getValue();
                    $noms = $feuille->getCellByColumnAndRow(2,$row)->getValue();
                    $postPren = $feuille->getCellByColumnAndRow(3,$row)->getValue();
                    $sexe = $feuille->getCellByColumnAndRow(4,$row)->getValue();
                    //example of my data base
                    $rqt = "INSERT INTO T_ETUDIANTS (E_ID,E_NOMS,E_PREPOST,E_SEXE)VALUES('$mat','$noms','$postPren','$sexe')";
                    $accuse = mysql_query($rqt)or die (mysql_error());
                //connection closing

i am a noob, pls help me...
i have downloaded the phpexcel but i dont know where to start with? where should i put this php excel file? and wht should i do next? =x

This question has already been answered. Start a new discussion instead.