Using several sheets

Topics: Developer Forum, User Forum
Jul 12, 2010 at 12:15 PM

Hi all!

I'd like convert my excel files in CSV files, but these files can contain several sheets.

I didn't succeed to switch between the sheets.

For example, i'd like to do something like that


$i = 0;
//for each worksheet, I write in my CSV file
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {


But setActiveSheetIndex doesnt seems to work. it's always the first sheet which is selected.

Thank you for your help

Jul 12, 2010 at 12:37 PM
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
$objWriter->setSheetIndex($i);   // will write the worksheet with index $i (default value is index 0, the first wiorksheet)


Jul 12, 2010 at 1:07 PM

thank you so much!