EasyXLS
http://forum.easyxls.com/

How to get a list of Worksheets in a workbook
http://forum.easyxls.com/viewtopic.php?f=5&t=719
Page 1 of 1

Author:  gregg.drennan@pb.com [ Tue Aug 19, 2008 7:09 pm ]
Post subject:  How to get a list of Worksheets in a workbook

I need to allow a user to interactively choose the spreadsheet to open but then provide a list, dropdown, etc. for the user to then choose the worksheet(s) to import.

I haven't been able to find anything in the documentation that addresses how to get a list of the worksheets in a workbook and would appreciate any information or direction where I might be able to find this.

Thanks,

Author:  daniela [ Thu Aug 21, 2008 5:17 am ]
Post subject: 

You ca use the following methods to build the list of worksheets:
ExcelDocument.SheetCount
ExcelDocument.easy_getSheetAt

Author:  gregg.drennan@pb.com [ Fri Aug 22, 2008 1:47 pm ]
Post subject: 

Hi Daniela,

While your solutiopn will tell me the number of sheets in the workbook and then allow importing them via the ordinal number it doesn't address my need of getting a list of the sheet names to then present to a customer from which they can the choose the sheet that they want to import.

I've found a method that works in C#, basically opening the workbook with OLEDB and then getting all the "tables" from the schema.

Since I've purchased the EasyXLS library and it is all about reading and writing workbooks and formatted worksheets, I assume that this would be one of the basic functionalities that EasyXLS would provide.

Author:  daniela [ Mon Sep 08, 2008 2:36 am ]
Post subject: 

You can use a code similar with this:

//Create the sheet list for the dropdown
ExcelDocument xls = new ExcelDocument();
xls.easy_LoadXLSFile(file);
for (int nSheet=0; nSheet<xls.SheetCount(); nSheet++){
yourlist.add(xls.easy_getSheetAt(nSheet)).getSheetName();
}

......................................................

//Load the selected sheet for the dropdown list
ExcelWorksheet xlsWorksheet = (ExcelWorksheet)xls.easy_getSheet(selectedSheetName);

Author:  gregg.drennan@pb.com [ Mon Sep 08, 2008 3:11 am ]
Post subject: 

Hi Daniela,

Thanks for the response but please see my previous comments regarding using only the EasyXLS functionallity.

Both of your previous suggested solutions would require Excel or at least the Excel runtime to be installed on our server... which our administrators refuse to do.

I need a EasyXLS based solution.

If EasyXLS doesn't support this then please just say so and I can get on with business.

Thanks,

Gregg

Author:  daniela [ Wed Sep 10, 2008 2:26 am ]
Post subject: 

Microsoft Excel is not required to be installed.

Page 1 of 1 All times are UTC - 4 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/