PermissionError: [Errno 13] Permission denied: 'Abc.xlsx'

jkn jkn_gg at nicorp.f9.co.uk
Wed Feb 9 10:24:30 EST 2022


On Wednesday, February 9, 2022 at 12:46:49 PM UTC, Christian Gollwitzer wrote:
> Am 09.02.22 um 08:46 schrieb NArshad:
> > When I enter data using Tkinter form in an Excel file when the excel file is closed there is no error but when I enter data using Tkinter form when the excel is already open following error comes:
> > PermissionError: [Errno 13] Permission denied: 'Abc.xlsx' 
> > 
> > 
> > 
> > What to do to correct this error? I have already searched on google search many times but no solution was found.
> It's impossible. Excel locks the file deliberately when it is open, so 
> that you can't overwrite it from a different program. Otherwise, the 
> file could become inconsistent. 
> 
> The correct way to handle it in the GUI is to tell the user via a 
> message box that the file is open and can't be written. 
> 
> An alternative to writing the file directly would be that you remote 
> control Excel; I think it provides a DDE API: 
> https://support.microsoft.com/en-us/office/dde-function-79e8b21c-2054-4b48-9ceb-d2cf38dc17f9 
> 
DDE? Wow, that takes me back...


More information about the Python-list mailing list