IgnoreReadOnlyRecommended not working from Python when opening Excel workbook

本小妞迷上赌 提交于 2019-12-13 15:23:04

问题


I have an excel workbook I need to open from python in a writable mode. The workbook is set up to have the prompt for a read only recommendation and this cannot be removed.

I am using the following:

import win32com.client
xl=win32com.client.Dispatch("Excel.Application")
filepath = 'C:\Users\FullFilePath.xlsm'
xl.Workbooks.Open(Filename=filepath, ReadOnly=False, IgnoreReadOnlyRecommended=True)

It opens the file, but it's still popping up the dialog asking if I want to open in read only. Is it possible to cancel that dialog?


回答1:


Use instead:

xl = win32com.client.DispatchEx('Excel.Application')

This works without a dialog box for me.



来源:https://stackoverflow.com/questions/43101074/ignorereadonlyrecommended-not-working-from-python-when-opening-excel-workbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!