[Tutor] new to python

Walter Prins wprins at gmail.com
Thu Nov 18 23:51:30 CET 2010


On 18 November 2010 21:13, gary engstrom <engstrom.gary at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101118/85151934/attachment.html>


More information about the Tutor mailing list