An Azure service for ingesting, preparing, and transforming data at scale.
I don't recommend bypassing the lock on files beginning with ~$.
Office creates ~$... files as temporary owner/lock files while the corresponding Word/Excel/PowerPoint document is open. They are part of Office's locking mechanism and normally disappear when you close the document cleanly.
If this happens during automated file processing, the safer approach is to exclude Office temporary files from the workflow (e.g., ~$.docx, ~$.xlsx, and ~$*.pptx), then process only the actual document after Office releases it.
Also, avoid repeatedly retrying or force-opening a locked temporary file. Another process accessing an Office temporary file at the wrong point can interfere with the Office save/rename operation, for example, antivirus software locking an Excel temporary file before Excel can rename it.
If your automation needs to react immediately when files appear, use a retry/backoff or file-stability check instead: ignore ~$ files and wait until the real Office document can be opened normally and its size/last-write time has stabilized before processing it.
If the ~$ file remains after you close all Office applications, first verify that no WINWORD.EXE, EXCEL.EXE, or other Office process still has the document open. The stale owner files can remain after an abnormal Office termination; once you're sure the document is no longer in use, you can remove the stale owner file.
So don't try to change Windows permissions or bypass the file handle. The better pattern is:
ignore ~$ → wait for the actual document to be released → process the actual document.
If you can share what is monitoring/processing the folder (PowerShell, FileSystemWatcher, Windows service, Python, backup software, etc.), we can suggest the cleanest way to implement that logic.
References:
Microsoft - “The document is locked for editing by another user”
Microsoft - Troubleshoot errors when saving Excel workbooks
Help make this community better for everyone: If this answer helped or resolved your issue, please accept it or upvote it. If not, share more details in a comment so we can continue the discussion and find the right solution. Thank you.