Is there a better way (besides COM) to remote-control Excel?

前端 未结 5 427
有刺的猬
有刺的猬 2021-01-07 08:55

I\'m working on a regression-testing tool that will validate a very large number of Excel spreadsheets. At the moment I control them via COM from a Python script using the l

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-07 09:41

    The Excel COM interface will not allow me to safely remote-control two seperate instances of the Excel application operating on the same workbook file, even if they are read-only.

    This is not a limitation of COM, this is a limitation of Excel. Excel will not even let you open two files with the same name at the same time if they exist in different directories. It is a fundamental limitation of the Excel program.

    To answer your other questions

    If you check your python documentation, there should be a way to connect to an existing server if the connection is lost.

    The lack of useful error messages again may be to do with Python.

    You cannot even use COM to find Excel's PID.

    COM is an internal object model and exposed what it wishes. PID are available to outside processes as much as they are to internal, there is no real reason to expose as a COM interface.

提交回复
热议问题