Edit this page
Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms | UI for Silverlight

What is a Worksheet?

This article will help you get familiar with the concept of a worksheet and its features.

What is a Worksheet

A Worksheet is a collection of cells organized in rows and columns. It is the working surface you interact with to enter data. Each worksheet contains 1048576 rows and 16384 columns and serves as a giant table that allows you to organize information. Typically, a workbook contains several worksheets with related content and only one of the worksheets is active at a time.

What is in it?

The main characteristics of worksheets can be summarized in the following list:

  • Cells: Each worksheet has a significant number of cells that can be assigned values and various formatting options. The Cells property allows you to insert, manipulate and delete worksheet cells. More information about worksheet cells is available in the What is a Cell? section.

  • Rows and Columns: Cells in a worksheet are organized in rows and columns. The API of a worksheet allows you insert, manipulate and delete rows and columns. Additionally, you can adjust the height of specific rows and the width of columns. For more info about rows refer to the Working with Rows and Columns section.

  • Names (Named Ranges): the Worksheet class exposes a Names property of type NameCollection that allows you to create, update and manage names. More about the feature is available in the Names article.

  • UsedCellRange and GetUsedCellRange(): Since each worksheet contains over a million rows and more than sixteen thousand columns, it is unlikely to use the full capacity of a worksheet. Typically, a worksheet uses only a part of the available cells. That said, in a number of scenarios you might want to know which part of the worksheet contains your data and ignore the rest of the cells. The UsedCellRange property of the Worksheet class returns a cell range that starts from cell A1 and holds all cells containing data or formatting. With the GetUsedCellRange() method you can pass and IEnumerable<IPropertyDefinition> object to get the used cell range, holding only the cells with specific property definitions. Example 1 demonstrates how to get the used cell range of cells with value.

    [C#] Example 1: Get the used cell range of cells with value

    CellRange result = worksheet.GetUsedCellRange(new IPropertyDefinition[] { CellPropertyDefinitions.ValueProperty });
    
  • Collection of Hyperlinks: Each worksheet can contain numerous hyperlinks to web pages, particular cells in the workbook or email addresses. More information on the topic is available in the Hyperlink article.

  • Find and Replace: You can easily find and replace text and numbers in the content of a worksheet. For more information about the feature see the Find and Replace article.

  • Protection: You can restrict the user from modifying the content and structure of the worksheet. When a worksheet is protected the user can edit the contents only of the cells that were explicitly marked as unlocked. Additionally, you can choose what options will be available to the user when protection is enabled. More about the feature is available in the Worksheet Protection article.