Hai All, I have a complex excel sheet ,wich contains details of companies and I need to import that using php and will store in a database…In the data base also multiple tables to manage this fields. How I can do this one using php?? regards, Prasanth
Prasanth, One option can be done is export excel document in CSV format and then use plain text file handling logic for grabbing data from file.. If you want to incorporate excel as it is then you may need some extra libraries which can read the meta data of excel file and process the file. honestly i have done data exporting in excel using some open source excel php library ... but CSV seems to be beat option in first iteration
CSV is indeed one of the better options; but note that it *might* be easier to use excel classes too phpExcel
Please review following scripts. It may be useful. <?php $row = 1; $handle = fopen("test.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); ?>