I need to get the sheet specific named ranges i.e., given the name of the namedRange and the sheet name, how can we get the range? Is there a way to pass sheet name as input parameter?
@vgm,
In MS Excel, there are two types of named ranges, i.e., global (Workbook scoped) and local/worksheet scoped named ranges, see the document for your reference:
To get specific worksheet scoped named range, you got to get it with respect to its worksheet, see the sample lines of code for your reference:
e.g
Sample code:
.............
WorksheetCollection worksheets = workbook.getWorksheets();
// Getting the specified local named range
Range namedRange = worksheets.getRangeByName("Sheet1!Range1");
........
Also, see the document on named ranges for your reference:
Hope, this helps a bit.