Walter, For those of us who are new to writing code that makes various software packages interact with each other, can you say more about what "COM object model" means in this context and where one can learn how to use it to make Python interact with Excel and with Windows software in general. I've seen term "COM" before and I know it has something to do with how Windows programs interact with each other, but that's about it. Can you suggest some resources for learning more?
Thanks, Joel _____ From: tutor-bounces+joel=joelschwartz....@python.org [mailto:tutor-bounces+joel=joelschwartz....@python.org] On Behalf Of Walter Prins Sent: Thursday, November 18, 2010 2:51 PM To: gary engstrom Cc: Tutor@python.org Subject: Re: [Tutor] new to python On 18 November 2010 21:13, gary engstrom <engstrom.g...@gmail.com> wrote: Being new to python I was wondering if there is a way to import exel data into pyrhon matrix/arrays so that I have some data to work with. I know R uses Rcmdr as an easy interface for excel data, which helps keep the reader engaged while learning the language. If you want to read/write an Excel format files, have a look at the "xlwt" and the "xlrt" Python modules (probably what Steven was aluding to). See http://www.python-excel.org/ These modules works quite well for reading/generating Excel files (with expectable limitations) from any platform that Python's available on (e.g. including non-Windows) and thus does not require Excel to be available on the machine you're producing the file on. If however you are running on Windows and have Excel installed, you could also consider driving the real Excel via COM automation, which will guarantee you get desired results including formatting, charts etc when generating sheets, and will ensure you have full access to all the functionality Excel exposes via its COM object model. If your requirements is simple enough though then Steven's suggestion to use CSV is probably preferable, e.g. export the data to CSV and then import with the "csv" module in Python. (The KISS principle applies here as elsewhere in programming: "Keep It Small & Simple") HTH, Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor