Yes, this error usually happens because the Excel lock file (.xls~) for that workbook is corrupted or left behind by a crash. To fix it, find and delete the temporary lock files associated with your spreadsheet, or use the Open and Repair feature in Excel.
What You'll Need
- A computer running Windows or macOS.
- The Microsoft Excel application installed.
- File Explorer (Windows) or Finder (macOS) to locate hidden files.
- Administrative privileges on the computer (to delete system or user profile folders).
Step-by-Step
- Identify the Corrupt File. Open the Excel file that is giving the error. Look at the filename in the title bar. It will likely end with a tilde (~). Note the full name of the file you are trying to open, excluding the tilde and the extension (e.g., if the file is named "Budget 2024.xlsm~", the base name is "Budget 2024.xlsm").
- Locate the Temporary Lock File.
Windows: Open File Explorer and navigate to the folder where the file is saved. If you cannot see the lock file, you must enable the viewing of hidden files and folders.
- Open File Explorer and click the View tab in the ribbon menu.
- Check the box labeled Hidden items.
Once enabled, look for a file with the exact same name as your spreadsheet but with a tilde (~) at the end of the filename, followed immediately by the extension (e.g., "Budget 2024.xlsm~"). This is the lock file.
macOS: You cannot easily see these files in Finder without a terminal command, but they are often located in the same directory. The most reliable method on macOS is the "Open and Repair" feature, described later in this guide.
- Delete the Lock File.
Windows: Right-click the lock file (the one with the tilde) and select Delete. Confirm the deletion when prompted. If you receive an "Access Denied" error, you may need to restart your computer to clear the file lock held by a previous session, or run File Explorer as an administrator.
macOS: Because Finder does not easily display these files, it is safer to proceed with the built-in repair tools rather than hunting for the file in the filesystem.
- Attempt to Open the File Again. Launch Excel and try to open the workbook. If the lock file was the cause of the issue, Excel should now open the file without prompting that it is already open.
- Use the Open and Repair Feature (Alternative for macOS or if deletion failed). If you cannot find or delete the lock file, or are on a Mac, use Excel’s built-in repair tool.
- Open Excel and go to File > Open.
- Browse to the location of the corrupted file.
- Click the arrow next to the Open button and select Open and Repair.
- Choose Repair to extract recoverable data. If that fails, choose Extract Data to view the workbook as read-only.
Common Mistakes
Deleting the wrong file. The lock file shares the base name with your actual spreadsheet. It is crucial to identify the file ending in the extension followed by a tilde (~). Deleting the actual spreadsheet will result in data loss, so double-check the filename before confirming the deletion.
Ignoring the "Read-Only" prompt. Sometimes, when a file is truly open in another instance of Excel, Excel will offer to open a Read-Only copy. If you do not want to work on a copy, you must close the other instance of Excel. If you simply click OK on the Read-Only prompt, you may create a new lock file, compounding the problem.
Tips
Check for Hidden Windows. Sometimes, a window for the file is minimized to the taskbar or hidden behind another application. Press Alt + Tab to cycle through open windows and see if the spreadsheet is actually open on a different desktop or monitor.
Save frequently. To minimize the risk of lock file corruption in the future, save your work frequently. This ensures that if Excel crashes, the data loss is minimal.
Use OneDrive or SharePoint. If your files are stored in the cloud, the issue might be a sync conflict rather than a local lock file. Check your OneDrive or SharePoint sync status and resolve any pending conflicts in the cloud before trying to open the file locally.
Troubleshooting
If the steps above do not resolve the issue, the problem may be deeper than a simple lock file. Follow this troubleshooting order to isolate the cause.
- Restart Excel and Your Computer. The simplest first step is to ensure no ghost processes are holding the file. Close all instances of Excel completely (check the system tray for hidden Excel icons) and restart your computer. This clears volatile memory locks and file handles that might be stale.
- Check for Excel Add-ins. Sometimes, third-party add-ins interfere with file handling. Try opening Excel in Safe Mode to see if the error persists.
- Close Excel completely.
- Hold down the Ctrl key and launch Excel from your Start menu or applications folder.
- If Excel opens without the error, an add-in is likely the culprit. Go to File > Options > Add-ins and disable COM Add-ins one by one to find the problematic one.
- Disable Windows Quick Access History. Windows 10 and 11 sometimes use the Quick Access feature to keep track of frequently used folders. This can sometimes cause Excel to think a file is open because it is tracking the folder activity. To disable this:
- Open File Explorer and click the View tab.
- Uncheck Show recently used files in Quick access.
- Uncheck Show frequently used folders in Quick access.
- Repair the Office Installation. If the issue is system-wide and affects multiple files, your Office installation might be corrupt. Use the Microsoft Support and Recovery Assistant tool (SaRA) to detect and repair Office installation issues.
Frequently Asked Questions
Why does Excel create a lock file?
Excel creates a temporary lock file (ending in ~) automatically whenever you open a workbook. It uses this file to record that the workbook is currently in use and to prevent other users or instances from overwriting your changes simultaneously. If Excel closes normally, it deletes this file.
Why does the lock file not disappear?
The lock file will not disappear if Excel crashes, freezes, or is closed improperly. In these cases, the program fails to execute the command to delete the temporary file before termination, leaving it behind as a remnant.
Can I open the file if the lock file exists?
No, you cannot open the file in a standard mode while the lock file exists. Excel will display an error message stating the file is already open by another user or process. You can only open it in Read-Only mode or use the Open and Repair function.
Does this work for all versions of Excel?
Yes, the logic behind the lock file and the method for deleting it applies to all versions of Microsoft Excel on Windows. On macOS, the file structure is different, and the best approach is usually to use the Open and Repair feature rather than manually managing lock files.
Is it safe to delete the lock file?
It is safe to delete the lock file as long as you are certain it is not your actual spreadsheet. It is always named the same as your spreadsheet followed by the extension and a tilde (~). There is no data stored in the lock file that you need to keep.
I deleted the lock file but the error persists. What now?
If the error persists after deleting the lock file, the issue is likely with the Excel application itself or a corrupted file structure. Try repairing your Office installation or using the Open and Repair feature on the specific file to recover your data.