sort in Excel

M

MK

u do it like this:

from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Workbooks.Open("D:\python\sortme.csv")
xlApp.Range("A1:C100").Sort(Key1=xlApp.Range("B1"), Order1=2)
xlApp.ActiveWorkbook.Close(SaveChanges=1)
xlApp.Quit()
del xlApp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,293
Messages
2,571,502
Members
48,189
Latest member
StaciLgf76

Latest Threads

Top