统计工作表中的单元格数

统计工作表中的单元格数

Aspose.Cells for Python via Java提供了统计工作表中单元格数量的功能。为此,API提供了Cells.getCount()或Cells.getCountLarge()属性。

以下代码片段显示了如何使用Cells.getCount()或Cells.getCountLarge()属性来获取工作表中单元格的数量。

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()))