from aspose.cells import Workbook from datetime import datetime from os import os, path # 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(".") # Create directory if it is not already present. IsExists = path.isdir(dataDir) if notIsExists: os.makedirs(dataDir) # Instantiating a Workbook object workbook = Workbook() # Obtaining the reference of the first worksheet worksheet = workbook.worksheets[0] # Adding a string value to the cell worksheet.cells.get("A1").put_value("Hello World") # Adding a double value to the cell worksheet.cells.get("A2").put_value(20.5) # Adding an integer value to the cell worksheet.cells.get("A3").put_value(15) # Adding a boolean value to the cell worksheet.cells.get("A4").put_value(True) # Adding a date/time value to the cell worksheet.cells.get("A5").put_value(datetime.now()) # Setting the display format of the date style = worksheet.cells.get("A5").get_style() style.number = 15 worksheet.cells.get("A5").set_style(style) # Saving the Excel file workbook.save(dataDir + "output.out.xls")