如何用py32com打开写保留的excel文件? [英] How to open write reserved excel file in python with win32com?
本文介绍了如何用py32com打开写保留的excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在python中使用win32com打开一个写保护的ms excel 2007文件 - 我知道密码。我可以用用户输入的密码打开它到Excel对话框中。我想要能够打开文件,而不需要任何用户交互。我尝试了以下操作,但仍然弹出对话框。
app.Workbooks.Open(filename.xls ,WriteResPassword =secret)
任何想法我做错了吗? >
谢谢,
Dave。
解决方案
如果我不尝试使用命名函数参数,我可以得到上面的代码。即以下作品:
app.Workbooks.Open(filename.xls,2,True,None,None,secret )
I'm trying to open a write-protected ms excel 2007 file using win32com in python -- I know the password. I can open it with user input of the password into the excel dialog box. I want to be able to open the file without any user interaction. I've tried the following, but it still pops up the dialog box.
app.Workbooks.Open("filename.xls", WriteResPassword="secret")
Any ideas what I'm doing wrong please?
Thanks,
Dave.
解决方案
I can get the above code to work if I don't try to use named function parameters. I.e. the following works:
app.Workbooks.Open("filename.xls", 2, True, None, None, "secret")
这篇关于如何用py32com打开写保留的excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文