from aspose.cells import Workbook

#  For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
#  The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
#  Creating a file stream containing the Excel file to be opened
fstream = open(dataDir + "book1.xls", "rb")
#  Opening the Excel file through the file stream
workbook = Workbook(fstream)
#  Accessing the first worksheet in the Excel file
worksheet = workbook.worksheets[0]
#  Grouping first six rows (from 0 to 5) and making them hidden by passing true
worksheet.cells.group_rows(0, 5, True)
#  Grouping first three columns (from 0 to 2) and making them hidden by passing true
worksheet.cells.group_columns(0, 2, True)
#  Saving the modified Excel file
workbook.save(dataDir + "output.xls")
#  Closing the file stream to free all resources
fstream.close()