How to get the list of worksheet from a workbook

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

Hi,
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?

Thanks.

 

 

 

Mar 11, 2010 at 11:10 AM

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>";