I received a number of suggestions using 'regular' Python and using
PythonWin for Python2.4 and a number of received examples and
code snippets I got it working. Thank you.
 
Nevertheless, I also tried the suggestion on using IronPython with
'just' the PIAs. On a Microsoft WindowsXP platform running Microsoft
Office2003 I installed the PIAs according to the accompanying
documentation but this does not yield success:
 
>>> import clr
>>> clr.AddReferenceToFile("excel.dll")
 
results in
 
>>> RuntimeError:  Could not add reference to assembly excel.dll
 
Suggestions are appreciated....
 
Sincerely yours,
 
Harold Weffers


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J. Merrill
Sent: Wednesday, February 08, 2006 6:01 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Question (Novice) on using Microsoft Excel via IronPython

There is very little, if any, advantage in attempting to "exploit .Net capabilities" when the goal of the task is to interact with code that is not based in .Net.  Excel does not have a .Net-based API; it has only a COM-based API.  It is both easier (less code to write, more available documentation) and more efficient (fewer "layers" to go through at execution time) to work with a COM-based API using unmanaged code rather than managed code.

If you were to use non-Iron Python (there is another post that has some code showing some of the incantations needed) you would be at least as close to the goal.

If you have a requirement to use a .Net language to complete the task, IronPython will be as good as anything.  You will need to get hold of (and install) the "primary interop assemblies" (PIAs) for the version of Excel that you're using -- and, if the program is to run on someone else's machine eventually, you'll have to get them (and .Net 2 and IronPython) onto that machine as well.  Holler if you need assistance with that. 

But I suggest you use "ordinary" Python for the task.  Good luck!
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to