Windows  ·  high  ·  Microsoft Office

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

the file format or file extension is not validWord experienced an error trying to open the fileProtected View0x800A03ECfile is corrupt and cannot be openedFile Block

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.

Download the read-only diagnosticchanges nothing · safe to run before reading

Fixes (4)

Clear the Mark of the Web and check Protected View
PowerShell as the affected user10 minuteslow riskreversible

The file arrived from outside the machine. Try this first — it is the most common of the three and the cheapest to test.

  1. Confirm the file carries the mark.

    PowerShell
    Get-Content -Path 'C:\path\to\file.xlsx' -Stream Zone.Identifier -ErrorAction SilentlyContinue
  2. Remove it, once you are satisfied the file is legitimate.

    PowerShell
    Unblock-File -Path 'C:\path\to\file.xlsx'
  3. 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".

  4. 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.

Confirm it workedThe file opens normally with no Protected View bar, and the Zone.Identifier stream is gone.
If you need to undo itNothing to reverse. If you changed a Protected View setting, put it back — those switches are there for a reason.
Download this fix as a PowerShell script2 steps you do yourself · asks before each step
Find out what the file actually is
PowerShell as the affected user15 minuteslow riskreversible

The file came out of a reporting system, an accounts package or a web export. This is the cause people spend longest missing.

  1. Read the first bytes of the file and compare them with what the extension claims.

    PowerShell
    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.

  2. 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.

  3. If it is a zip, rename it to the correct modern extension — .xlsx, .docx or .pptx — and open it.

  4. 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.

  5. Where a system produces these repeatedly, fix the export at source rather than renaming files forever.

Confirm it workedThe file opens with its content intact and the columns and formatting where they should be.
If you need to undo itRename the file back. Nothing inside it has been modified.
Download this fix as a PowerShell script4 steps you do yourself · asks before each step
Check the File Block policy
PowerShell as the affected user20 minutesmedium riskreversible

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.

  1. Read the current File Block settings for the application.

    PowerShell
    Get-ItemProperty 'HKCU:\Software\Microsoft\Office\16.0\Excel\Security\FileBlock' -ErrorAction SilentlyContinue

    A 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.

  2. Also check the policy hive, which overrides the user one and cannot be changed by the user.

    PowerShell
    Get-ItemProperty 'HKCU:\Software\Policies\Microsoft\Office\16.0\Excel\Security\FileBlock' -ErrorAction SilentlyContinue
  3. Decide 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.

  4. If it is to be permitted, set the specific format to open in Protected View rather than fully trusting it.

    PowerShell
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Office\16.0\Excel\Security\FileBlock' -Name 'Excel95Workbooks' -Type DWord -Value 1
  5. Once the file is open, save it to a current format so the problem does not recur.

Confirm it workedThe file opens, in Protected View if that is what you set, and re-saves cleanly as .xlsx or .docx.
If you need to undo itSet the value back to 2, or delete the value you added, to restore the block.
Download this fix as a PowerShell script2 steps you do yourself · asks before each step
Recover a file that is genuinely damaged
The Office application, with a copy of the file40 minutesmedium riskreversible

The first three have been ruled out. Assume the file matters and work on a copy throughout.

  1. Copy the file somewhere local before doing anything to it, and keep the original untouched.

    PowerShell
    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.

  2. 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.

  3. If the file is a modern format, it is a zip — check whether it is structurally intact.

    PowerShell
    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.

  4. Look for an AutoRecover copy and for previous versions, both of which are frequently faster than any repair.

    PowerShell
    Get-ChildItem "$env:APPDATA\Microsoft\Excel" -Recurse -Include *.xlsb,*.xlsx -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 10 FullName, LastWriteTime
  5. If 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.

Confirm it workedThe recovered file opens, the data is complete, and it re-saves without a warning.
If you need to undo itThe original file was never modified — discard the working copy and start again if a recovery attempt made things worse.
Download this fix as a PowerShell script2 steps you do yourself · asks before each step

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.