Count the number of cells in the Worksheet

Count the number of cells in the Worksheet

Aspose.Cells for Python via Java provides the ability to count the number of cells in the worksheet. For this, the API provides the Cells.getCount() or Cells.getCountLarge() properties.

The following code snippet shows how to use the Cells.getCount() or Cells.getCountLarge() properties to get the number of cells in a worksheet.

source_directory = "Examples/SampleFiles/SourceDirectory/"
# Load source Excel file
workbook = Workbook(source_directory + "Book1.xlsx")
# Access first worksheet
worksheet = workbook.getWorksheets().get(0)
# Print number of cells in the Worksheet
print("Number of Cells: " + str(worksheet.getCells().getCount()))