Calling python script from excel/vba

后端 未结 6 994
一个人的身影
一个人的身影 2020-11-28 05:48

I have a python code that reads 3 arguments (scalars) and a text files and then returns me a vector of double. I want to write a macro in vba to call this python code and wr

6条回答
  •  不知归路
    2020-11-28 06:23

    Here is a good link for Excel from/to Python usage:

    continuum.io/using-excel

    mentions xlwings, DataNitro, ExPy, PyXLL, XLLoop, openpyxl, xlrd, xlsxwriter, xlwt

    Also I found that ExcelPython is under active development.

    1. https://github.com/ericremoreynolds/excelpython

    2.

    What you can do with VBA + Python is following:

    Compile your py scripts that take inputs and generate outputs as text files or from console. Then VBA will prepare input for py, call the pre-compiled py script and read back its output.

    3.

    Consider Google Docs, OpenOffice or LibreOffice which support Python scripts.

    This is assuming that available options with COM or MS script interfaces do not satisfy your needs.


    This is not free approach, but worth mentioning (featured in Forbes and New York Times):

    https://datanitro.com


    This is not free for commercial use:

    PyXLL - Excel addin that enables functions written in Python to be called in Excel.

提交回复
热议问题