0

I am done with basic import to database. I have explained in the following example where I got stuck up ...

For example,

I have an xls file named project.xls and it has 6 sheets. I have populated all 6 sheet names in dropdown. If I select sheet2 and click button, it should import sheet2 data into db and sheet3 so on.

How can I do this ...? please help me...

svl
  • 11
  • 1
  • 8
  • This question is [too broad](http://stackoverflow.com/help/on-topic). – Jørgen R Dec 10 '14 at 11:25
  • In its current state, this question is too broad. Please indicate what you have tried so far and where you are stuck (in code). – Jean Dec 10 '14 at 11:26

1 Answers1

0

You can access to differents sheets of a file with PHPExcelReader this way:

$filename = "path/to/filename.xls";
$reader = new Spreadsheet_Excel_Reader(); // Your PHPEXCELREDER Class
$reader->setOutputEncoding('UTF8');
// Read XLS File
$reader->read($filename);
$sheet = 2; // Your sheet

// Then walk trough your wanted sheet:

for ($i = 2; $i <= $reader->sheets[$sheet]['numRows']; $i++) {
// Do something
}
Jona
  • 1,156
  • 10
  • 16
  • Ok the initial question is changed, you don't talk anymore about how to access different sheets, maybe this don't help so... – Jona Dec 10 '14 at 11:35