$objPHPExcel->getSheetByName('Worksheet 1') ->setSheetState(PHPExcel_Worksheet::SHEETSTATE_HIDDEN);
or
$objPHPExcel->getSheetByName('Worksheet 1') ->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN);
EDIT
You can use Excel Format / Sheet / Hide to hide the entire worksheet. This sets the visible worksheet property for xlSheetHidden. But if you do not protect the password from the structure of the workbook, anyone can select "Format / Sheet / Show" to see the hidden sheet.
If you are using Excel 97 or later, you can "hide" the sheet:
- Press Alt-F11 to display the Visual Basic Editor
- in the project window, double-click Microsoft Excel objects and select the sheet that you want to hide.
- Press F4 to display the properties window.
- Set the visible property to xlSheetVeryHidden.
Now the sheet is no longer available through Format / Sheet / Unhide
This is what PHPExcel does more simply when you set SheetState to VERYHIDDEN
Mark baker
source share