from aspose.cells import Workbook
from aspose.cells.tables import TableStyleType

#  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 workbook object
book = Workbook()
#  Access first worksheet
sheet = book.worksheets[0]
#  Add column headings in cell A1 and B1
sheet.cells.get(0, 0).put_value("Column A")
sheet.cells.get(0, 1).put_value("Column B")
#  Add list object, set its name and style
listObject = sheet.list_objects[sheet.list_objects.add(0, 0, 1, sheet.cells.max_column, True)]
listObject.table_style_type = TableStyleType.TABLE_STYLE_MEDIUM2
listObject.display_name = "Table"
#  Set the formula of second column so that it propagates to new rows automatically while entering data
listObject.list_columns[1].formula = "=[Column A] + 1"
#  Save the workbook in xlsx format
book.save(dataDir + "output_out.xlsx")