I have a .xls file with plenty of named ranges containing values I would like to extract. The end goal is to automate that data extraction, but there is no fixed template apart from the named ranges.
I'm pretty new with the NPOI package and the farthest I could get was to retrieve the formula of the named range, though I'm not sure if that's the right way to go, since it involves parsing the returned string.
var file = new HSSFWorkbook(new FileStream(@"D:\test.xls", FileMode.Open));
var range = file.GetName("Test");
var test = range.RefersToFormula;
Console.WriteLine(test);
returns (as a string)
Sheet2!$C$2:$C$3
Instead of that formula, I would like to extract the values of the cells contained in that $C$2:$C$3 range. Is there an easier way to do that other than string parsing?
Thanks a lot!