Error:
self.fp = io.open(file, filemode) PermissionError: [Errno 13] Permission denied: ‘D:gst_filerinvoice_datajan~$Jan05 Miracle gurukrupa.xlsx’
Code:
wb = openpyxl.load_workbook(filename=os.path.abspath(file), read_only=True) ws = wb.active cell_val = ws.cell(row=6,column=2) print(cell_val)
Advertisement
Answer
in addition to the answer with with statement
(which is very good):
elf.fp = io.open(file, filemode) PermissionError: [Errno 13] Permission denied: 'D:gst_filerinvoice_datajan~$Jan05 Miracle gurukrupa.xlsx'
make sure that your file is not used by another process
, such as excel app
or another program that reads .xlsx