How to get the list of worksheet from a workbook

Topics: Developer Forum, User Forum
Mar 11, 2010 at 11:52 AM

After uploading the xls file, I want to be able to show the list of available worksheets in a <select><option> control.
Then user will make the selection of worksheet and click on the button to display the content of the worksheet.
But I am not able to locate any function or example that shows this. Is there a function to count the number of worksheet in a workbook and another function to read the name of the Active worksheet?





Mar 11, 2010 at 12:10 PM

I just saw a hint [getSheetNames();] - 3 posts before me after my posting.

$worksheets = $objPHPExcel->getSheetNames();
echo "<select id='wksheet' name='wksheet'>";
foreach ($worksheets as $key => $value){
 echo "<option value='$key'>$value</option>";

echo "</select>";