I would like to create the equivalent of this VBA macro from excel in Xlwings:
Sub sortononecol()
Range("A4").CurrentRegion.Sort key1:=Range("A4"), order1:=xlAscending, Header:=xlYes
End Sub
I tried using the script below but got different results.
last_row = ws.range('B' + str(ws.cells.last_cell.row)).end('up').row
ws.range("A4:N{row}".format(row=last_row)).api.Sort(Key1=ws.range("A5:A{row}".format(row=last_row)).api, Order1=1, Header=1)
Does anyone know what I am doing wrong? Thanks!
