Hi,
You can use the Pages collection to get all the pages in the specified folder, and then figure out those pages that are workbooks by GetType method, and then get the worksheets in the workbook by Layers collection. See the following example.
void worksheets_folder()
{
Folder fld("/folder1/"); // folder1 under the root folder
if(!fld)
return;
foreach(PageBase page in fld.Pages) // all pages in folder1
{
if(page.GetType() == EXIST_WKS) // if the page is workbook
{
WorksheetPage wp(page); // worksheet page (workbook)
int nWks = wp.Layers.Count(); // number of worksheets in workbook
for(int ii = 0; ii < nWks; ii++)
{
Worksheet wks = wp.Layers(ii); // worksheet
out_str("Worksheet: " + wks.GetName() + " in " + wp.GetName() + " Workbook"); // output worksheet name
}
}
}
}
Penn