I’ve got a legacy application which is implemented in a number of Excel workbooks. It’s not something that I have the authority to re-implement, however another application that I do maintain does need to be able to call functions in the Excel workbook.
It’s been given a python interface using the Win32Com library. Other processes can call functions in my python package which in turn invokes the functions I need via Win32Com.
Unfortunately COM does not allow me to specify a particular COM process, so at the moment no matter how powerful my server I can only control one instance of Excel at a time on the computer. If I were to try to run more than one instance of excel there would be no way of ensuring that the python layer is bound to a specific Excel instance.
I’d like to be able to run more than 1 of my excel applications on my Windows server concurrently. Is there a way to do this? For example, could I compartmentalize my environment so that I could run as many Excel _ Python combinations as my application will support?
I don’t know a thing about Python, unfortunately, but if it works through COM, Excel is not a Single-Instance application, so you should be able to create as many instances of Excel as memory permits.
Using C# you can create multiple Excel Application instances via:
Using late binding in C# you can use:
If using VB.NET, VB6 or VBA you can use CreateObject as follows:
Unfortunately, in Python, I don’t have a clue. But unless there is some limitation to Python (which I can’t imagine?) then I would think that it’s very do-able.
That said, the idea of having multiple instances of Excel acting as some kind of server for other operations sounds pretty dicy… I’d be careful to test what you are doing, especially with respect to how many instances you can have open at once without running out of memory and what happens to the calling program if Excel crashed for some reason.