Skip to content

Dimension (used range)

Mats Alm edited this page Nov 10, 2026 · 6 revisions

This page has moved. The current version of this page is at https://epplussoftware.com/docs/worksheet-and-ranges/addressing/dimension-used-range/. The EPPlus documentation is no longer updated in this wiki; please use the EPPlus guides and update your bookmarks.

The ExcelWorksheet.Dimension property exposes an address that indicates the area of the worksheet that contains cell values, formulas or styling. See example below:

using var package = new ExcelPackage();
var sheet = package.Workbook.Worksheets.Add("Sheet 1");
sheet.Cells["A1"].Value = 1;
sheet.Cells["A2"].Value = 2;
sheet.Cells["A3"].Value = 3;
sheet.Cells["B1"].Value = 4;
sheet.Cells["B2"].Value = 5;
sheet.Cells["B3"].Value = 6;
Console.WriteLine($"Dimension address: {sheet.Dimension.Address}");
Console.WriteLine($"Dimension from row: {sheet.Dimension.Start.Row}");
Console.WriteLine($"Dimension to row: {sheet.Dimension.End.Row}");
Console.WriteLine($"Dimension from column: {sheet.Dimension.Start.Column}");
Console.WriteLine($"Dimension to column: {sheet.Dimension.End.Column}");

This code will result in the following output:

Dimension address: A1:B3
Dimension from row: 1
Dimension to row: 3
Dimension from column: 1
Dimension to column: 2

Getting the worksheet dimensions for values only

If you want to know the first or last value or the dimension for the worksheets cells having values, your can use the properties FirstValueCell, LastValueCell and DimensionByValue exposed by the ExcelWorksheet class.

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally

⌂ 换网址