python中的excel加载项

发布于 2025-01-20 11:27:43 字数 99 浏览 6 评论 0原文

有什么办法可以使用Python制作 Excel 附加/扩展?

我尝试过JavaScript,但在Python上添加插件尚未找到任何结果。

Is there any way I can make Excel add-ins/extensions using Python?

I have tried javascript but haven't found any result about making add-ins on python.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

氛圍 2025-01-27 11:27:43

您可以尝试Xloil(免责声明:我写了)。文档为在这里。要编写一个简单的三个输入函数,您将使用以下方式安装Xloil:

pip install xloil
xloil install

然后编写:

import xloil

@xloil.func
def myfunc(x, y, z):
    return x + y * z

将此代码放置:

  1. 在与电子表格同一目录中的PY文件中,名为book1.py(如果您的工作表为 在Python模块路径上的PY文件中调用book1.xlsx
  2. ,然后编辑%appData%\ xloil \ xloil \ xloil.ini按照文档中所述加载它。

启动Excel,打开电子表格,该功能将以myFunc提供。

You could try xlOil (disclaimer: I wrote it). The docs are here. To write a simple three input function, you would install xlOil using:

pip install xloil
xloil install

Then write:

import xloil

@xloil.func
def myfunc(x, y, z):
    return x + y * z

Put this code either:

  1. In a py file in the same directory as your spreadsheet, named Book1.py (if your sheet is called Book1.xlsx)
  2. In a py file on your python module path, then edit %APPDATA%\xlOil\xlOil.ini to load it as described in the docs.

Start Excel, open your spreadsheet and the function will be available as myfunc.

谁人与我共长歌 2025-01-27 11:27:43

VSTO(或 OfficeJS)不为 Python 提供任何东西。 MS 没有开发 Python 框架。

您可能会发现像 PyXLL 这样的自定义扩展很有帮助。

VSTO (or OfficeJS) doesn't provide anything for Python. There is no framework for Python developed by MS.

You may find custom extensions like PyXLL helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文