Excel shows a sharing violation when it cannot write to the file because another process has it locked — usually a second Excel window, a synced cloud folder, or a leftover temp file. The fix is to close the other holder, save to a local folder, or clear the lock; you rarely need to repair Office. Below is the practical order that resolves most cases without losing work.
What You'll Need
- The workbook that triggers the error, and permission to save in its folder.
- Access to Task Manager (Windows) or Activity Monitor (Mac) to close stuck Excel processes.
- File Explorer (Windows) or Finder (Mac) to check folder sync status and temp files.
- Optional: a local folder such as Documents for a test save.
Step-by-Step
- Save a copy immediately. In Excel, use File > Save As and choose a local folder like Documents or Desktop, not a synced OneDrive, Dropbox, or network path. Give it a new name such as workbook-copy.xlsx. This preserves your edits while you fix the lock. If Save As also fails, use File > Save a Copy or copy the open sheet contents into a new blank workbook and save that locally.
- Close every other Excel window. A second instance of the same file, even minimised, holds a lock. On Windows, check the taskbar and Alt+Tab; on Mac, check the Dock and Window menu. Close the duplicate and retry saving the original.
- Check for a read-only prompt. If Excel offered "Read-Only" or "Notify" when you opened the file, you are editing a locked copy. Close without saving, then reopen from the original location and confirm you are not in Protected View or read-only mode. The title bar shows [Read-Only] when this is the case.
- End stuck Excel processes. On Windows, press Ctrl+Shift+Esc, open Task Manager, find every Microsoft Excel entry under Processes, right-click and choose End task. On Mac, open Activity Monitor, search Excel, select each entry and click the stop button, then Force Quit. Reopen the workbook and save again. Unsaved changes in those processes are lost, so do this only after Step 1.
- Pause cloud sync. If the file lives in OneDrive, Dropbox, Google Drive, or iCloud Drive, the sync client can hold a lock while uploading. Pause syncing from the tray or menu bar icon, wait for the status to show paused, then save. Resume sync afterwards. If the folder shows a sync error, open the client and resolve it before saving.
- Move the file out of the synced folder. Copy the workbook to a plain local folder, open it there, and save. If that works, the lock is coming from sync or the network share. You can move it back once sync is healthy, or keep working locally and upload when finished.
- Clear leftover temp files. Close Excel, then in File Explorer enable hidden items (View > Show > Hidden items) and open the same folder as the workbook. Delete files starting with
~$that match the workbook name. On Mac, press Cmd+Shift+. in Finder to show hidden files and remove the same~$files. These are owner-lock files; deleting them is safe when Excel is closed. - Disconnect and reconnect network shares. For files on a NAS or shared drive, disconnect the mapped drive, reconnect it, and reopen the file. If others have the file open, ask them to close it; Excel's own sharing features do not always prevent this error on network storage.
- Restart the computer. A restart clears orphaned file handles from crashed add-ins, antivirus scans, or backup tools. Reopen the workbook and save to a local folder first to confirm the fix.
- Test with a blank workbook. Create a new workbook and save it to the same folder. If that fails too, the problem is the folder or drive permissions, not the file. Try saving to another drive or ask your administrator to check folder permissions.
Common Mistakes
- Clicking Save repeatedly without closing the other holder; each attempt fails the same way.
- Deleting the
~$lock file while Excel is still open, which can corrupt the owner record. - Assuming the file is corrupt and running repair before checking for a second Excel window or sync client.
- Saving to a USB drive or network share that is disconnected or full; the error can look like a sharing violation.
- Ignoring the read-only banner and editing for a long time before noticing saves are not landing.
Tips
- Save early to a local folder, then copy to the synced or shared location when finished.
- Keep only one Excel window per shared workbook; use Excel's own co-authoring for OneDrive and SharePoint files rather than opening multiple copies.
- Check the title bar for [Read-Only] or [Shared] before editing.
- If you use antivirus with real-time scanning, add the workbook folder to its exclusions only if your administrator approves; scanning can briefly lock files.
- Name test saves clearly, such as workbook-local-test.xlsx, so you do not confuse them with the original.
Troubleshooting
If the error persists after closing other windows and pausing sync, work through these checks in order. First, confirm the folder is not full or offline: open File Explorer or Finder and check free space and network status. Second, try saving the same content as a new file in a different local folder; if that succeeds, the original folder or file is the problem, not Excel. Third, sign out of and back into your Microsoft account in Excel (File > Account > Sign out, then sign in) to refresh file permissions for cloud-stored workbooks. Fourth, update Office through File > Account > Update Options > Update Now, or the Microsoft AutoUpdate app on Mac, since older builds can mishandle locks. Fifth, if the workbook opens but every save fails, copy all sheets into a new workbook and save that; this bypasses a damaged file structure without deleting your original. Finally, if only one shared drive fails for everyone, ask the administrator to check share permissions and offline files settings; do not attempt to change server permissions yourself.
Frequently Asked Questions
What does a sharing violation mean in Excel?
It means Excel cannot write to the file because another process or user has it locked — commonly a second Excel window, a sync client, or a network share.
Will I lose my unsaved changes?
Only if you end Excel processes or force quit before saving a copy. Use File > Save As to a local folder first, then close stuck processes.
Can I fix it without closing Excel?
Sometimes, by pausing cloud sync or disconnecting the network share. If the lock is another Excel window, you must close that window.
Is it safe to delete the ~$ files?
Yes, when Excel is fully closed. They are temporary owner-lock files, not your workbook data.
Why does it happen only on OneDrive or a network drive?
Sync clients and network shares can hold file handles during upload or while another user has the file open. Saving locally first avoids the conflict.
Do I need to repair Office?
Usually not. Repair is a last resort after checking locks, sync, permissions, and a test save to another folder.