473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

sort in Excel

MK
Hello,

Does anyone knows how to use the Excel sort function in python?

Apr 16 '06 #1
1 6861
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

Apr 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dr. Ann Huxtable | last post by:
Hello All, I am reading a CSV (comma seperated value) file into a 2D array. I want to be able to sort multiple columns (ala Excel), so I know for starters, I cant be using the array, I need...
1
by: William.R.Reisen | last post by:
Hi, I have currently in Xcel and long list of X English phrases in one column with associated numerical data about each name in adjoining columns. I have on another workbook (which could of...
1
by: Dave | last post by:
Hi, I am new to this group and relatively new to Access. I have tried to find the answer to this question by reading other posts but have had no joy so please forgive me if I am repeating covered...
1
by: deko | last post by:
I need to import dates from a linked table then export them out as text to an Excel spreadsheet. The problem is the dates need to be in ascending order when I dump them out to Excel - and there's...
2
by: Kathy Burke | last post by:
Hi again, I have a datagrid which uses several fields such as: <asp:BoundColumn DataField="DateEntered" HeaderText="Date Entered" SortExpression="DateEntered"></asp:BoundColumn> All works...
1
by: nate axtell | last post by:
In VB .NET I load the contents of an Excel or comma seperated values file into a dataGrid (via a datatable). One of the columns has a comma in the name of the column. So for the comma separated...
2
by: kogrover | last post by:
ISSUE: COM Excel Sort works with Early Binding, but not Late Binding, but py2exe only does Late Binding I have code similar to this (type from notes, so there may be a typo...) import...
6
by: Kc-Mass | last post by:
In a standard Ascii table a dash or hyphen is decimal 45. A period or dot is decimal 46. If I sort a table or recordset of mixed character string ascending in Access, those strings beginning with...
1
by: Socko | last post by:
I'm trying to fix an sub routine in an VB module that basically reads in a MS database and writes it to an Excel Spread sheet. It works just fine except that the data isn't sorted correctly. I have...
5
kcdoell
by: kcdoell | last post by:
I have a form that I want to change the way the subform (continuous) is displaying the info (the sort order). In another words, I want to give the user the ability to see the same information in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.