Fix Excel Error: 'filename.xlsx' is Locked for Editing on Network Shares

intermediate📊 Microsoft Excel2026-05-24| Windows 10/11, Windows Server (SMB/CIFS Share), Microsoft Excel 2016/2019/2021/Microsoft 365

Error Message

'filename.xlsx' is locked for editing by 'username'. Click 'Notify' to open a read-only copy of the document and receive notification when the document is no longer in use.
#shared-drive#excel-fix#file-lock#smb-error#windows-server

The Problem: Ghost Locks on Shared DrivesShared network drives make collaboration easy until you hit the 'file is locked' wall. You call your colleague, 'username', only for them to tell you they closed that spreadsheet an hour ago. Despite this, Excel insists the file is still in use. This ghost lock usually stems from a hiccup in the SMB (Server Message Block) protocol, where a network blip or an improper exit leaves a session hanging on the server.

It is a frustrating bottleneck for teams. In most cases, the file isn't actually open on anyone's desk; the server simply hasn't realized the session ended.

Why This HappensExcel generates a tiny hidden file—typically around 1KB—the moment you open a spreadsheet. This 'owner file' starts with ~$ (e.g., ~$budget.xlsx) and acts as a digital 'Do Not Disturb' sign for other users. If a laptop goes to sleep, a VPN disconnects, or Excel crashes, this file stays behind. The server continues to honor the lock, thinking the original user is still active.

Quick Fix: Clear the Orphaned Owner FileStart by hunting for the leftover temporary file. Even if the user has exited Excel, this hidden file might still be sitting in the directory.

  • Navigate to the folder containing the Excel file.- In File Explorer, click the View tab and ensure Hidden items is checked.- Look for a file named ~$filename.xlsx.- Try to delete it. If it disappears, the lock is gone. If Windows says the file is 'in use by System,' you need a server-side intervention.```

Check for these hidden files quickly via Command Prompt

dir /a:h ~$*


## Level 2: Force Close Sessions on the File ServerIf you cannot delete the 1KB temp file, the file server is likely holding an active SMB handle. You will need to drop the session manually.
### Using Computer Management (GUI)- Log into the File Server with administrator credentials.- Right-click 'Start' and select **Computer Management**.- Go to **System Tools > Shared Folders > Open Files**.- Locate the specific spreadsheet in the list.- Right-click the entry and select **Close Open File**.### Using Command Line (The Pro Approach)Admins can identify and kill locks in seconds using the `net file` command. It is much faster than scrolling through a GUI list of hundreds of files.

List every open shared file on the server

net file

Close the specific file using its ID number

net file [id] /close


## The Silent Killer: The 'Preview Pane' BugOne of the most common causes of recurring locks is actually the **Preview Pane** in Windows File Explorer. When a user clicks a file just to see its content in the side panel, Windows Explorer creates a read-only lock to generate that preview. If the previewer process hangs, it prevents anyone else from editing the file.
### The Solution:- Encourage your team to disable the Preview Pane using **Alt + P** when browsing shared folders.- If the error persists, disable the 'Details Pane' as well, as it can trigger similar locking behavior.## Infrastructure and Network StabilityWhen these errors happen daily across different departments, it usually indicates network instability. Latency spikes above 100ms or minor packet loss can cause SMB sessions to 'zombify.' If your team is spread across multiple subnets, check that your routing isn't causing micro-disconnects.
I often use a [Subnet Calculator](https://toolcraft.app/en/tools/developer/ip-subnet-calculator) when auditing office networks to ensure CIDR ranges and gateway settings are consistent. Misconfigured subnets can lead to delayed TCP handshakes, which confuse the Excel locking mechanism.
## How to Verify the FixFollow these steps to ensure the file is truly healthy:
- Confirm that no `~$` files remain in the folder.- Open the file yourself. It should load directly into 'Edit' mode without any prompts.- Ask the user who originally 'locked' it to open and close the file. Watch the folder to see if the `~$` file appears and vanishes as it should.If the error keeps coming back for one specific person, check their Task Manager for 'ghost' `excel.exe` processes. Sometimes a crashed instance of Office stays running in the background, holding the file handle open indefinitely.

Related Error Notes