Talk:Interacting with Excel

From IronPython Cookbook

Please don't torture yourself by attempting to use Excel through COM.

As you're already using python, rather use the following excellent packages for dealing with excel files:

xlrd

xlwt

xlutils

I'm not sure how long ago it is since you've used Excel via the managed COM interfaces, but although not my idea of fun it is nothing like as bad as you've painted it. In addition the libraries you point to, whilst great for use from Python, are extremely limited - not even allowing you to access formulae in spreadsheet for example. I'm editing your contribution on the main page to make it slightly less inflammatory.

Formula support is there, from what I've heard. If not in a release, I believe it is on the trunk. It'll take a lot of work to convince me that COM isn't slow compared to xlrd or xlwt, given that COM essentially automates a GUI app...

...I also find your removal of the licensing problems a little irresponsible unless you know that MS is now offering server licenses for Excel?

I didn't think it was a relevant fact to include on a page about how to use Excel from COM. Your additions come across as being more interested in promoting why not to do this, which is not at all the intention of this page and website. I would ask you to honour the intent of this site while you promote alternative solutions.

On the contrary, I think anyone intending to find out how to do something should be aware of the consequences of doing so. If you're breaking the law by doing something, I'd find that pretty relevent.

Furthermore, with several years experience of doing so, I can't see it being a good idea for anyone to interact with an Excel instance via COM. Fair enough, if there's a specific component for reading or writing excel files that has to be accessed via COM, but Excel itself is essentially a client-machine GUI app that has no place in server-based work...

As for the intent of this site, I thought it was to help people do things in IronPython. xlrd and xlwt are, afaik, the best ways to work with Excel files in IronPython for most people. If there's an index page or some such I should write an article purely about them on, then let me know...


Well - there are a huge number of people who do use COM to automate Excel (which can be done without the use of the UI), and for people wanting to do it from IronPython this page is a useful resource. If you want to create a page on this wiki showing examples using xlrd and xlwt from IronPython then that would be great. Feel free to link to that page from this page.

TOOLBOX
LANGUAGES