Access Worksheet

Accessing a Worksheet

All worksheets contained in Aspose.Cells.GridWeb, are stored in the GridWeb control’s GridWorksheetCollection. There are two ways to access a worksheet: by its sheet index or by its sheet name.

Using Sheet Index

The code snippet below shows how to access a specific web worksheet from the GridWeb control’s GridWorksheetCollection using the sheet index.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing a worksheet using its index
GridWorksheet sheet = GridWeb1.WorkSheets[0];
Label1.Text = "Sheet at index 0 is : " + sheet.Name + "<br/>";

Using Sheet Name

The code snippet below shows how to access a web worksheet from the GridWeb control’s GridWorksheetCollection collection using the sheet name.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing a worksheet using its name
GridWorksheet sheet1 = GridWeb1.WorkSheets["Catalog"];
Label1.Text += "Index of sheet Catalog is : " + sheet1.Index + "<br/>";