Can you call Python from Excel in instances of Excel other than the first? -


this question calling python excel. in vba you'd runpython("import mymodule; mymodule.my_function()")

in python have like,

from xlwings import workbook, sheet, range      def my_function():         wb = workbook.caller() # create reference calling excel file         range('a1:c3').clear_contents() # clear cells 

my question work first instance of excel. in event have 2 instances open, , you're trying run code in second instance, raised exception saying, "can't establish connection! make sure calling workbook active 1 , opened in first instance of excel."

so seems designed work on first instance. there way around this? can identify instance you're in in python script? user hoping run vba macros call excel across multiple instances.

in principle, xlwings can deal 2 instances. however, depending on security settings, might treat files downloaded internet or stored on network drive unsecure , "sandbox" them. these files accessible xlwings if run in first instance. if sounds issue, lowering security settings potentially solve issue. see answer here.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -