Reputation: 1485
I need to open an xls file from python using win32com as read-only and I seem not be getting the effect I desire
Here is what I do:
import win32com
xl = win32com.client.Dispatch('Excel.Application')
wb = xl.Workbooks.Open(file_path, ReadOnly=1) # 1 is for readonly
The workbook opens and data shows; however, the file is not opened as read-only.
per MSDN argument signature should trigger read-only effect but it does not.
Anyone had to deal with similar problem before?
Upvotes: 0
Views: 9367
Reputation: 6103
ReadyOnly
is a third parameter according to the documentation.
Pass None
for the UpdateLinks
and True for ReadyOnly
.
wb = xl.Workbooks.Open(file_path, None, True)
Upvotes: 3