在尝试使用XLRT,XLWT和Xlutils在现有文件中附加数据时,是否可以在Excel文件(XLS)中保存宏?
我基本上试图使用XLRD XLWT和Xlutils中的现有Excel文件(.xls)中的相关单元格添加数据。我能够将数据放在文件中的相关单元格中,但是,在此过程中未保留宏按钮。有什么办法可以将数据附加到XLS文件中,而不会干扰宏(或原始文件)?
我尝试了这样的事情将值集成到所需的单元格中:
import xlwt
import xlrd
import xlutils.copy import copy
rb=xlrd.open_workbook('try.xls')
wb=copy(rb)
w_sheet=wb.get_sheet(0)
w_sheet.write(0,2,15)
wb.save('try.xls')
我是这样这样做的,因为我需要将一些值放在现有的XLS文件中,然后使用文件中存在的按钮来执行进一步的操作。我是新手。任何帮助将不胜感激。谢谢!
I am basically trying to add data to concerned cells in an existing excel file(.xls) using xlrd xlwt and xlutils. I am able to put the data to the concerned cell in the file, however, the macro buttons are not preserved in this process. Is there any way that I can append my data to the xls file without disturbing the macros(or the original file)?
I tried something like this to incorporate the values to the required cells:
import xlwt
import xlrd
import xlutils.copy import copy
rb=xlrd.open_workbook('try.xls')
wb=copy(rb)
w_sheet=wb.get_sheet(0)
w_sheet.write(0,2,15)
wb.save('try.xls')
I am doing it this way as I need to put some values in an existing xls file and then use that to perform further operations using the buttons present in the file. I am new to this. Any help would be appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论