Reputation: 119
What I need to know is, can I get Python to read a spreadsheet (preferably Microsoft Excel), then parse the information and input it into an equation?
It's for a horse-racing program, where the information for several horses will be in one excel spreadsheet, in different rows or columns. I need to know if I can run a calculation for each of those horses separately and then calculate a score for the given horse.
Upvotes: 2
Views: 16031
Reputation: 7991
OpenPyXL ("A Python library to read/write Excel 2007 xlsx/xlsm files") has a very nice and Pythonic API.
Upvotes: 3
Reputation: 12486
My suggestion is:
csv
comma separated value file, which is a plain text format and much easier to work with.csv
module to work with the data in csv format.You can work with Excel files directly in Python (Excel 2003 format supported via the third party modules xlwt, xlrd) but this is much harder than working with CSV.
Upvotes: 3
Reputation: 134691
Use xlrd
package. It's on PyPI, so you can just easy_install xlrd
Upvotes: 1
Reputation: 6043
You can export the spreadsheet as a .csv and read it in as a text file, then process it. I have a niggling feeling there might even a CSV parsing python library.
AFAIK there isn't a .xls parser, although I might be wrong.
EDIT: I was wrong: http://www.python-excel.org/
Upvotes: 0