How to remove a Sheet

Topics: Developer Forum
Oct 6, 2010 at 4:28 PM

Im using a template with differents sheets, but depending on the situation i want to use one sheet or other....

how can i remove one sheet from the file to be create?

Oct 6, 2010 at 6:26 PM
Oct 6, 2010 at 9:17 PM


Nov 8, 2010 at 2:09 PM

Hi Mark,

          Just an extension to the above.Suppose I don't know the sheetIndex but I know the sheet name, like Sheet1

Then how can I remove it??

Is there a way??

Nov 10, 2010 at 11:42 AM

You can get a list of the sheet names as an array (indexed by sheet index) using the getSheetNames() method of the PHPExcel object.

Alternatively, you can use the setActiveSheetIndexByName() method to set the sheet to the one you want, then use the getActiveSheetIndex() method to get the index.