What happens when you overwrite an Excel file, and whether you can get it back
When you save over an Excel file on a Mac, the original version is usually gone from your hard drive — but not always from your computer entirely. macOS keeps temporary versions of files you've worked on, and if you saved the file to iCloud Drive or OneDrive, older versions may still exist in the cloud. Your best recovery option depends on which of these systems caught a copy before you overwrote it.
The catch: recovery works best if you act quickly, before your Mac overwrites the temporary storage space where the old file sits. If weeks have passed, or if your Mac has been restarted many times, the temporary version may already be gone. But if you overwrite a file and realize it immediately — or within a few days — you have real options.
Key Takeaways
- Check iCloud Drive or OneDrive first if your Excel file was stored there, since both services keep version history for 30 days or longer.
- If the file was only on your Mac's local drive, use the Undo command (Command+Z) right after overwriting, or check the Trash if you deleted it.
- macOS keeps temporary file versions in a hidden folder, but recovery from there requires Terminal commands and works only if the file hasn't been overwritten yet.
- Time matters: the longer you wait or the more you use your Mac, the less likely the old version survives in temporary storage.
Recover from iCloud Drive or OneDrive version history
If your Excel file lives in iCloud Drive or OneDrive, both services automatically save older versions. This is your strongest recovery path because the versions are stored separately from your Mac and persist for weeks.
For iCloud Drive: Open Finder, click iCloud Drive in the sidebar, find your Excel file, right-click it, and select "See all versions" (or "Info" then "Versions" depending on your macOS version). A timeline appears on the right side showing saved versions. Click the version you want, then click "Restore" at the bottom. The file reverts to that version on your Mac and in iCloud.
For OneDrive: Open OneDrive in your web browser (onedrive.live.com), find the file, right-click it, and select "Version history". A list of saved versions appears with timestamps. Click the version you need, then click "Restore" to replace the current file. You can also download an old version without restoring it, which is useful if you want to compare before committing.
Both services keep versions for at least 30 days. OneDrive keeps them longer if you have a Microsoft 365 subscription — up to 93 days in some cases. If your file was synced to the cloud, this method usually works even if you've already restarted your Mac.
Use Undo immediately after overwriting
If you just overwrote the file seconds or minutes ago and haven't closed Excel yet, press Command+Z to undo the save. This works only if Excel is still open and you haven't performed other actions since the overwrite. It's the fastest recovery method when it works.
Once you close Excel or perform other actions in the program, the undo history clears and this option is gone. If you've already closed the file, move to the other recovery methods.
Check the Trash for a deleted file
If you overwrote the file by deleting the old version first, then saving a new one with the same name, the deleted file may still be in your Trash. Click the Trash icon in the Dock, find your Excel file, right-click it, and select "Put Back". The file returns to its original location.
Trash is emptied automatically after 30 days on newer Macs, or you can empty it manually. If you've already emptied Trash, the file is much harder to recover. If Trash still contains the file, this is a simple recovery with no risk.
Recover from macOS temporary file storage
macOS stores temporary versions of files you're working on in hidden folders. If your overwritten file was recently in use, a copy may still exist in these temporary locations. Recovery from here requires using Terminal, which is a command-line tool built into macOS.
To search for temporary versions: Open Terminal (find it in Applications > Utilities > Terminal). Type this command and press Enter:
find ~/Library/Caches -name "*Excel*" -o -name "*your-filename*" 2>/dev/null
Replace "your-filename" with the actual name of your file. Terminal searches hidden cache folders and lists any files matching that name. If you see results, note the full path shown. You can then copy the file to your Desktop to examine it. This method works only if the temporary file hasn't been overwritten yet, which usually means within a few days of the original overwrite.
If Terminal feels unfamiliar, this method is worth skipping unless you're comfortable with command-line tools. The other methods are more straightforward and work for most situations.
Use Time Machine if you have backups enabled
If you've been using Time Machine to back up your Mac, you can recover an older version of your Excel file from a backup. Click the Time Machine icon in the menu bar (top right of your screen), select "Enter Time Machine", then navigate to the date before you overwrote the file. Find your Excel file, select it, and click "Restore".
Time Machine only works if you've already set it up and connected an external drive or configured it to back up to an external location. If you haven't used Time Machine, this option isn't available. If you have, it's one of the most reliable recovery methods because backups are separate from your working files.
Prevent overwriting in the future
The easiest recovery is avoiding the problem. Store important Excel files in iCloud Drive or OneDrive so version history is automatic. Enable Time Machine with an external drive as a second layer of backup. In Excel itself, you can also enable AutoSave (File > AutoSave) if your file is in OneDrive or iCloud, which saves versions as you work without requiring you to manually save.
Before you overwrite a file you're unsure about, save it with a new name first (File > Save As) and keep the original. This takes 10 seconds and eliminates the risk entirely. Many people use a naming system like "filename-v1", "filename-v2" to track versions manually, which also protects against accidental overwrites.
Frequently Asked Questions
How long does macOS keep temporary file versions?
Temporary files are usually overwritten within days or weeks, depending on how much you use your Mac and how much storage space is available. There's no fixed timeline. If you overwrite a file and wait a month before trying to recover it, the temporary version is likely gone. Act within a few days for the best chance.
Can I recover an overwritten file if I don't have iCloud or OneDrive?
If the file was only on your Mac's local drive and you don't use cloud storage or Time Machine, recovery is much harder. Undo (Command+Z) works only if Excel is still open. The Terminal method may find a temporary copy, but only if it hasn't been overwritten yet. Without backups or cloud sync, there's no may provide. This is why setting up iCloud or OneDrive is worth doing now, before you need it.
Does restarting my Mac make recovery impossible?
Restarting doesn't immediately delete temporary files, but it does clear Excel's undo history. If your file is in iCloud or OneDrive, restarting doesn't affect version history at all — those versions are stored in the cloud. If you're relying on temporary storage on your Mac's drive, restarting increases the chance that temporary files get overwritten, so recovery becomes less likely the longer you wait after a restart.
What if the recovered file is still corrupted or incomplete?
If you recover a version and it's damaged or missing data, try recovering an earlier version from the same source. iCloud and OneDrive let you see multiple versions with timestamps, so you can try a version from before the corruption started. If all recovered versions have the same problem, the corruption may have existed before the overwrite, and recovery won't fix it.
Can third-party recovery software recover an overwritten Excel file on Mac?
Third-party recovery tools exist, but they're unreliable for recently overwritten files on modern Macs. They work better on older systems or external drives. Before paying for recovery software, try the free methods first: iCloud/OneDrive version history, Undo, Trash, and Time Machine. If none of those work, recovery software is unlikely to help either.