A document will not open — Protected View, "file format is not valid", or a corrupt file
Office refuses a file with a message about it being corrupt or the wrong format. Genuine corruption is the least likely of the three causes — far more often the file is blocked by policy, or it is honestly a different format than its extension claims.
What you see
The file opens for someone else but not here, or opens on one machine and not another. Messages vary by application: Excel says the format or extension is not valid, Word says it experienced an error trying to open the file, and either may open a blank Protected View window that never proceeds.
What is actually wrong
Three distinct things wearing the same message. Protected View plus a Mark of the Web will stall a file from the internet or a share. File Block settings, often applied by a hardening baseline, refuse whole formats outright — older .xls and .doc especially. And a file exported by a reporting system is frequently HTML or CSV given an .xls extension, which Excel is right to reject.
Codes and articles
Start here — find out which fix applies
A script that runs the 3 inspection commands from the write-up below and prints what each one returned. It reads the machine and changes nothing — every command that could write, delete, start or stop is excluded from it by construction. Run this first, then pick the fix its output points at.
Fixes (4)
Clear the Mark of the Web and check Protected View
The file arrived from outside the machine. Try this first — it is the most common of the three and the cheapest to test.
Confirm the file carries the mark.
Get-Content -Path 'C:\path\to\file.xlsx' -Stream Zone.Identifier -ErrorAction SilentlyContinueRemove it, once you are satisfied the file is legitimate.
Unblock-File -Path 'C:\path\to\file.xlsx'If it still will not open, look at what Protected View is set to. File → Options → Trust Center → Trust Center Settings → Protected View has three separate switches, and a hardening baseline often enables all of them plus "Always open untrusted database files in Disabled mode".
Test by copying the file to a local folder that is not synced and opening it there.
This separates a Protected View problem from a file problem in one step. If the local copy opens, the fault is the zone or the sync location, not the document.
Find out what the file actually is
The file came out of a reporting system, an accounts package or a web export. This is the cause people spend longest missing.
Read the first bytes of the file and compare them with what the extension claims.
Get-Content -Path 'C:\path\to\file.xls' -Encoding Byte -TotalCount 8 | ForEach-Object { $_.ToString('X2') }50 4B 03 04 is a zip, so the file is really a modern .xlsx or .docx. D0 CF 11 E0 is the old compound format, a genuine .xls or .doc. Anything starting 3C (a '<' character) is HTML or XML with a spreadsheet extension, which is what most reporting exports produce.
If it is HTML, rename it to .html and open it in a browser to confirm, then let Excel import it properly via Data → From Web or Data → From Text/CSV rather than opening it directly.
If it is a zip, rename it to the correct modern extension — .xlsx, .docx or .pptx — and open it.
If it is the old compound format with a modern extension, rename it to .xls or .doc.
Office decides how to parse a file from its extension first. Correcting the extension is not a workaround here — it is telling Office the truth about the file.
Where a system produces these repeatedly, fix the export at source rather than renaming files forever.
Check the File Block policy
Old formats fail across the board — every .xls or every .doc — rather than one particular file. These blocks exist because the legacy binary formats have a long history of parser vulnerabilities: unblock the narrowest format that solves the problem, convert the file, and put the block back.
Read the current File Block settings for the application.
Get-ItemProperty 'HKCU:\Software\Microsoft\Office\16.0\Excel\Security\FileBlock' -ErrorAction SilentlyContinueA value of 2 blocks the format outright. 1 opens it in Protected View. 0 permits it. Baselines such as the Microsoft security baseline set several of these to 2, which is a deliberate hardening choice someone made, not a defect.
Also check the policy hive, which overrides the user one and cannot be changed by the user.
Get-ItemProperty 'HKCU:\Software\Policies\Microsoft\Office\16.0\Excel\Security\FileBlock' -ErrorAction SilentlyContinueDecide whether the format should be permitted at all. The right answer for a one-off archive file is usually to convert it on a controlled machine, not to unblock the format for everyone.
If it is to be permitted, set the specific format to open in Protected View rather than fully trusting it.
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Office\16.0\Excel\Security\FileBlock' -Name 'Excel95Workbooks' -Type DWord -Value 1Once the file is open, save it to a current format so the problem does not recur.
Recover a file that is genuinely damaged
The first three have been ruled out. Assume the file matters and work on a copy throughout.
Copy the file somewhere local before doing anything to it, and keep the original untouched.
Copy-Item 'C:\path\to\file.xlsx' "$env:USERPROFILE\Desktop\file-working-copy.xlsx"Every recovery route below can make things worse. The original is the only thing that guarantees you can start again.
Use Open and Repair: File → Open → Browse, select the file, then click the arrow beside the Open button and choose Open and Repair. Try Repair first, then Extract Data if that fails.
If the file is a modern format, it is a zip — check whether it is structurally intact.
Add-Type -AssemblyName System.IO.Compression.FileSystem[IO.Compression.ZipFile]::OpenRead("$env:USERPROFILE\Desktop\file-working-copy.xlsx").Entries | Select-Object FullName, Length
If this lists xl/workbook.xml and the sheets, the container is fine and the damage is inside one part — often recoverable by opening the file in LibreOffice, which is more tolerant of malformed XML, and re-saving it.
Look for an AutoRecover copy and for previous versions, both of which are frequently faster than any repair.
Get-ChildItem "$env:APPDATA\Microsoft\Excel" -Recurse -Include *.xlsb,*.xlsx -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 10 FullName, LastWriteTimeIf the file lives on a share or in OneDrive, check version history there before spending any more time on repair — it very often has a clean copy from an hour earlier.
Related faults
Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.