<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.6036" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=734471200-19112010>Walter,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=734471200-19112010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=734471200-19112010>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?<BR><BR>Thanks,<BR>Joel</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
tutor-bounces+joel=joelschwartz.com@python.org
[mailto:tutor-bounces+joel=joelschwartz.com@python.org] <B>On Behalf Of
</B>Walter Prins<BR><B>Sent:</B> Thursday, November 18, 2010 2:51
PM<BR><B>To:</B> gary engstrom<BR><B>Cc:</B> Tutor@python.org<BR><B>Subject:</B>
Re: [Tutor] new to python<BR></FONT><BR></DIV>
<DIV></DIV><BR><BR>
<DIV class=gmail_quote>On 18 November 2010 21:13, gary engstrom <SPAN
dir=ltr><<A
href="mailto:engstrom.gary@gmail.com">engstrom.gary@gmail.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>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</DIV>
<DIV>for excel data, which helps keep the reader engaged while learning the
language.</DIV><BR></BLOCKQUOTE></DIV><BR>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 <A
href="http://www.python-excel.org/">http://www.python-excel.org/</A>
<BR><BR>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.<BR><BR>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.<BR><BR>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")<BR><BR>HTH,<BR><BR>Walter<BR></BODY></HTML>