Accessing named Ranges in Designer File


business supplies us with some Workbooks we are to scan data of / fill data in. They mark the area we need to deal with using a named range. When I load up the designer file into Aspose.Excel the Sheet.Cells.Ranges property does not return any predefined ranges. Is this by design? Is there any other area I can look up predefined ranges in?

Any help would be appreciated



Hi Kai,

Please try Worksheets.GetNamedRanges method.


thanks for the update. I should read the docs more carefully. However, I have just tried it and found out that there seems to be a problem with the named range being returned.

Taks the attached Excel file and inspect the Range called “daten” (w/o quotes). It claims to start on row 10 / column 1 and is 14 rows high / 7 columns wide.

However I have extended the original range (that was set up as such) to start on row 7 / column 1 and being 17 rows high / 7 columns wide.

If you could possibly check this, please. I’m using version



BTW: When you open the attachment in Excel, select the range, it looks just fine

I don’t find this problem. Please try the attached fix.


using this fix, the problem does not show.

Thanks a lot



Aspose.Cells has replaced Aspose.Excel that is no more under active development now and is discarded. This new product Aspose.Cells contains rich features to work with named ranges. You can not only create and modify cells with respect to a range but also copy named ranges, access all the named ranges in a workbook, get start and end cells of a range and access a specific named range. Following is a simple code that demonstrates creation and accessing the named range in a worksheet.

// Instantiate a new Workbook.
Workbook workbook = new Workbook();

// Get the first worksheet in the workbook.
Worksheet worksheet1 = workbook.Worksheets[0];

// Create a range of cells based on H1:J4.
Range range = worksheet1.Cells.CreateRange("H1", "J4");

// Name the range.
range.Name = "MyRange";

// Input some data into cells in the range.
range[0, 0].PutValue("USA");
range[0, 1].PutValue("SA");
range[0, 2].PutValue("Pakistan");
range[1, 0].PutValue("UK");
range[1, 1].PutValue("AUS");
range[1, 2].PutValue("Canada");
range[2, 0].PutValue("France");
range[2, 1].PutValue("Russia");
range[2, 2].PutValue("Egypt");
range[3, 0].PutValue("China");
range[3, 1].PutValue("Philipine");
range[3, 2].PutValue("Brazil");

Range targetRange = workbook.Worksheets.GetRangeByName("MyRange");
// Identify range cells.
Console.WriteLine("First Row : " + targetRange.FirstRow);
Console.WriteLine("First Column : " + targetRange.FirstColumn);
Console.WriteLine("Row Count : " + targetRange.RowCount);
Console.WriteLine("Column Count : " + targetRange.ColumnCount);
// Save the excel file.

For more information about named ranges refer to the following article:
Create Access and Copy Named Ranges

Here you can download the latest free trial version:
Aspose.Cells for .NET (Latest Version)

A ready to run application is available here that can be used to test the product features without writing any code.