from ironxl import * # Load an existing WorkSheet workbook = WorkBook.Load("sample.xls") worksheet = workbook.WorkSheets[0] # Set data display format to range worksheet["A3"].Value = DateTime(2020, 1, 1, 12, 12, 12) worksheet["A4"].Value = DateTime(2022, 3, 3, 10, 10, 10) worksheet["A5"].Value = DateTime(2021, 2, 2, 11, 11, 11) selected_range = worksheet["A3:A5"] # The cell(A3) value will look like 1/1/2020 12:12:12 PM selected_range.FormatString = "MM/dd/yy h:mm:ss" # Save changes with applied number formats workbook.SaveAs("numberFormats.xls")
Excel Number Format