是否有一个等同于PyXll @xl_func(macro=True)的装饰师?
这将允许与Excel中的整个工作簿进行交互吗?
一个虚拟示例:单元格中的=test() 'E5‘返回一个错误:
@xw.func
def test():
wb = xw.Book.caller()
wb.sheets[0].range('A1').formula = wb.name
return 'done'意外的Python : TypeError: SAFEARRAYS的对象必须是序列(序列)或缓冲区对象。
为了澄清起见:我希望能够编写Excel函数,而不需要数组、公式、按钮或宏。
发布于 2016-08-09 10:50:10
是的,xw.sub,来自文档
import xlwings as xw
@xw.sub
def my_macro():
"""Writes the name of the Workbook into Range("A1") of Sheet 1"""
wb = xw.Book.caller()
wb.sheets[0].range('A1').value = wb.namehttps://stackoverflow.com/questions/38845707
复制相似问题