Force file extension to match file type
Explanation
This policy setting controls how Excel loads file types that do not match their extension. Excel can load files with extensions that do not match the files' type. For example, if a comma-separated values (CSV) file named example.csv is renamed example.xls (or any other file extension supported by Excel 2003 and earlier only), Excel can properly load it as a CSV file.
If you enable this policy setting, you can choose from three options for working with files that have non-matching extensions:
- Allow different - Excel opens the files properly without warning users that the files have non-matching extensions. If users subsequently edit and save the files, Excel preserves both the true, underlying file format and the incorrect file extension.
- Allow different, but warn - Excel opens the files properly, but warns users about the file type mismatch. This option is the default configuration in Excel.
- Always match file type - Excel does not open any files that have non-matching extensions.
If you disable or do not configure this policy setting, if users attempt to open files with the wrong extension, Excel opens the file and displays a warning that the file type is not what Excel expected.
Registry
HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\excel\security- Value name
- not defined in the ADMX
Enable / disable values: not defined in the ADMX (see the options below).
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: excel16/L_Forcefileextenstionstomatch
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
#
# Possible options:
# Allow different = 0
# Allow different, but warn = 1
# Always match file type = 2
Set-ItemProperty -Path $k -Name 'extensionhardening' -Value 1 -Type DWordDisable
# Disable: excel16/L_Forcefileextenstionstomatch
# No value is written in the "Disabled" state (nothing defined in the ADMX)Revert to "Not configured"
# Revert to "Not configured": excel16/L_Forcefileextenstionstomatch
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
Remove-ItemProperty -Path $k -Name 'extensionhardening' -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| L_Empty | Drop-down listenum | extensionhardening | REG_DWORD | Default choice (UI): #1
|
Application
Microsoft 365 Apps / Office (Microsoft) — November 2026 templates
Official templates downloaded on November 12, 2026.