Satya jeet Mehra
Satya jeet Mehra

Reputation: 93

best way of reading excel file and storing it in mysql table.? my table contains 4 coloumns

I have a excel file(xls) and My table contains 4 columns. They are id, item_number, item_name, item_group

My excel file looks lie following.

Row_id  Item_No Item_Name Item_Group
  1         1234      abcd        AF      
  5         6556      abcd        CD      
  7         9898      abcd       CRMD      
  8         65456     abcd       CSD    

I am trying from 2 hours i didn't have any good example, how to aceive this..??

I want to acheive this in PHP.

Upvotes: 1

Views: 28

Answers (1)

Sai kumar
Sai kumar

Reputation: 61

Use PHPExcel package

$inputFileName = 'mails.xls';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
foreach($sheetData as $row){
    print_r($row);
    //do what you want to do
}

Upvotes: 1

Related Questions