开发者社区> 问答> 正文

利用python中的xlwings模块操作excel中发生的报错??? ?报错

点击表单按钮后,python报错为(如下图):

图片说明

一、宏:
Sub hi()
runpython ("from xlw import say_hi;say_hi()")
End Sub
二、python:
import xlwings as xlw
def say_hi():
wb = xlw.Book.caller()
sht = wb.sheets[0]
sht.range('A1').value = 'Hello, world'

展开
收起
爱吃鱼的程序员 2020-06-23 00:38:28 814 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    出错:找不到xlw模块
    就是说你runpython("fromxlwimportsay_hi;say_hi()")找不到xlw这个文件夹,你核对下文件路径

    参考这篇文章吧。里面写的很详细。https://blog.csdn.net/qq_24499417/article/details/85177249

    2020-06-23 00:38:46
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载