All guides

Excel says the file is locked for editing — who has it, how to clear it, and how to get at the data now

The lock is a small hidden file Excel writes beside the workbook while it is open — ~$ followed by the workbook’s name — and it records who opened it. When that name is yours, an earlier Excel window is still running, a preview pane has the file open, or a sync client is holding it; when Excel crashed, the lock file simply outlived it. Nothing in the workbook is damaged, and the data can be read without waiting for the lock to clear.

Who really has it open

On a shared drive the name in the message is usually right, and the fix is to ask. On your own machine it is usually you: a second Excel window behind the first, the file still open from before a crash, or Windows Explorer’s preview pane, which opens a workbook to draw its thumbnail and holds it while it does. On OneDrive and SharePoint the sync client can hold a file while it uploads a change, and the message names the account rather than the program.

Show hidden files in the folder and the lock file is visible: ~$Budget.xlsx next to Budget.xlsx. Its date is when it was created; a lock from last Tuesday belongs to an Excel that is no longer running.

Clear the lock

Close every Excel window, then check Task Manager for an Excel that is still running without a window, and end it. Close the preview pane in Explorer. On OneDrive or SharePoint, open the file from the web to see who is in it, or wait for the sync to settle. When nobody has the file open and the lock file is still there, deleting the ~$ file is safe: Excel writes a new one the next time the workbook opens.

If the file lives on a network share and the lock belongs to a session that has gone, the server administrator can release the open-file handle; deleting the lock file alone is not always enough there.

Get the data now without the lock

The lock only stops Excel from opening the workbook for writing. The Excel converter here reads the workbook file directly, without Excel and without the lock, and writes a CSV for each sheet with every value kept as text — numbers as they were, and dates written as 2024-01-31 whatever the cell’s display format, so they read the same everywhere. Open that CSV in the editor to look at or change the data, or compare it against an earlier export to see what changed.

The converter reads the file as it is on disk, so unsaved changes in the other person’s Excel are not in it. What it gives you is the last saved version, which is what the file holds.

It reads the modern .xlsx and .xlsm formats. An old binary .xls has to be opened read-only in Excel — which the lock allows — and saved as .xlsx first.

Questions

Why does it say the file is locked by me?
Because an Excel process still has it open — a window behind another, one that survived a crash, or the Explorer preview pane. Close them, check Task Manager for a lingering Excel, and the lock clears.
Is it safe to delete the ~$ lock file?
When nobody has the workbook open, yes. It holds only the name of who opened it; Excel creates a fresh one the next time the file opens. Deleting it while someone is actually editing lets two people save over each other.
Can I read the data while it is locked?
Yes. Open it here with the Excel converter, which reads an .xlsx or .xlsm file directly, or choose Read Only in Excel. Both show the last saved version. An old .xls needs Read Only in Excel and Save As .xlsx first.
Will the converter see unsaved changes from the other person?
No. It reads the file on disk, which holds the last save. Changes still open in someone else’s Excel exist only in their window until they save.
Why does OneDrive lock a file nobody is editing?
The sync client holds the file while it uploads or downloads a version, and a stuck sync holds it indefinitely. Pausing and resuming sync, or opening the file from the web, usually releases it.
Is my file uploaded anywhere?
No. The workbook is read directly in your browser, lock file or not; getting past the lock never involves sending the file somewhere else to be opened. Every request the Network tab in your developer tools shows while it reads is for this site’s own code; none carries the workbook.