[IronPython] Question (Novice) on using Microsoft Excel viaIronPython

Eric Larson ionrock at gmail.com
Wed Feb 8 17:15:38 CET 2006


Could you also connect to a COM object (or do something similar) and then
use IronPython similar to VBScript? I am not sure, but this may have been
what the original poster wanted.

Of course I could be wrong and simply putting my hopes to use IronPython as
a macro language on the table :)

Eric


On 2/8/06, J. de Hooge <info at geatec.com> wrote:
>
>  Sorry, I forgot where I found this, but maybe it helps…
>
>
>
> # this example starts Excel, creates a new workbook,
>
> # puts some text in the first and second cell
>
> # closes the workbook without saving the changes
>
> # and closes Excel.  This happens really fast, so
>
> # you may want to comment out some lines and add them
>
> # back in one at a time ... or do the commands interactively
>
>
>
> from win32com.client import Dispatch
>
>
>
> xlApp = Dispatch("Excel.Application")
>
> xlApp.Visible = 1
>
> xlApp.Workbooks.Add()
>
> xlApp.ActiveSheet.Cells(1,1).Value = 'Python Rules!'
>
> xlApp.ActiveWorkbook.ActiveSheet.Cells(1,2).Value = 'Python Rules 2!'
>
> xlApp.ActiveWorkbook.Close(SaveChanges=0)
>
> xlApp.Quit()
>
> del xlApp
>
>
>
> # raw_input("press Enter ...")
>
>
>
> Kind regards
>
> Jacques de Hooge
>
> info at geatec.com
>
>
>
>
>
> -----Oorspronkelijk bericht-----
> *Van:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *Namens *Weffers, H.T.G.
> *Verzonden:* Wednesday, February 08, 2006 1:10 PM
> *Aan:* users at lists.ironpython.com
> *Onderwerp:* [IronPython] Question (Novice) on using Microsoft Excel
> viaIronPython
>
>
>
> If the following is a too frequently asked question, then please
>
> forgive me.
>
>
>
> Being a novice in the use of IronPython and Python I spent a
>
> significant amount of time trying to find the answer to the below
>
> question in a FAQ list, but until now I did not (yet) find a (pointer
>
> to a) useful answer.
>
>
>
> Using IronPython (on a Microsoft Windows XP platform) I want to
>
> develop an application that takes data from a specific range of
>
> cells in a Microsoft Excel Workbook (file), processes the relevant
>
> data, and then creates a graph representation using GraphViz.
>
>
>
> What I am currently most looking for is a way of accessing the
>
> specific data in the Microsoft Excel file, preferably using the
>
> most recent beta of Microsoft IronPython effectively 'exploiting'
>
> its .Net capabilities.
>
>
>
> Concrete suggestions for or pointers to (similar) solutions are
>
> appreciated.
>
>
>
> Sincerely yours,
>
>
>
> Harold Weffers
>
>
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060208/047b1805/attachment.html>


More information about the Ironpython-users mailing list