Quoting David Holland <[EMAIL PROTECTED]>: > Dear Tutors, > > I know how to open files in python, however what I want to do is select > some information from an excel spreadsheet and save it as a .dat file. > The bit, I am stuck on is :- > How can I select all rows with a row number greater than x for a certain > column ?
If you don't want to go with COM, there are a couple of packages that might be useful: xlrd and pyExcelerator. I've used pyExcelerator; it includes functions to parse a spreadsheet into a dictionary. You could do something like this (untested): import pyExcelerator workBook = pyExcelerator.parse_xls('myfile.xls') sheet = workBook['Sheet1'] # Or whatever the worksheet is called print sheet.items()[:5] # prints something like: ((3, 2), 'foo'), ((1, 0), 'bar'), etc rowsAbove3 = dict([(x, sheet[x]) for x in sheet if x[0] > 3]) # etc -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor