from aspose.cells import CellArea, OperatorType, ValidationType, Workbook

#  For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
#  Create a workbook object.
workbook = Workbook()
#  Create a worksheet and get the first worksheet.
ExcelWorkSheet = workbook.worksheets[0]
#  Accessing the Validations collection of the worksheet
validations = workbook.worksheets[0].validations
#  Create Cell Area
ca = CellArea()
ca.start_row = 0
ca.end_row = 0
ca.start_column = 0
ca.end_column = 0
#  Creating a Validation object
validation = validations[validations.add(ca)]
#  Setting the validation type to whole number
validation.type = ValidationType.WHOLE_NUMBER
#  Setting the operator for validation to Between
validation.operator = OperatorType.BETWEEN
#  Setting the minimum value for the validation
validation.formula1 = "10"
#  Setting the maximum value for the validation
validation.formula2 = "1000"
#  Applying the validation to a range of cells from A1 to B2 using the
#  CellArea structure
area = CellArea()
area.start_row = 0
area.end_row = 1
area.start_column = 0
area.end_column = 1
#  Adding the cell area to Validation
validation.add_area(area)
#  Save the workbook.
workbook.save("output.out.xls")