Read XLSIO Named Range cell value

I have a spreadsheet with a set of named ranges. Each range defines a single cell. I wish to read each of the cell values with a specified type: double, integer, text, date.
I can retrieve the collection of names through workbook.Names and workbook.Names.Count.
for (int i = 0; i < workbook.Names.Count; i++)
{
    s = workbook.Names[i].Name.ToString();
}

How do I use the collection 'workbook.Names[i]' to read the cell value in each case ?
Do I have to parse the range name 'xxxxxxxxx'!$A$1 in each case and read the worksheet cell value or is there a property/method in the Names[] collection ?

1 Reply

MM Manikandan M Syncfusion Team February 13, 2013 11:53 AM UTC

Hi Richard,

Thanks for using Syncfusion products.

For reading the cell value, we could use the 'Value' property of named range in worksheet range property  .We have created the simplified sample to read the cell value for above said scenario and have attached the same in the below link.

Sample link:107065.zip

Code snippet:
            string name;
            object cellValue;
            for (int i = 0; i < workbook.Names.Count; i++)
            {
                name = workbook.Names[i].Name.ToString();
                cellValue = workbook.Worksheets[0].Range[workbook.Names[i].Value].Value;
            }

Thank you very much for your patience. Please let us know if you need any clarifications.

Thanks,
Manikandan M.

Loader.
Up arrow icon