Force file extension to match file type
| Registry value | extensionhardening |
| Group Policy | Force file extension to match file type |
| German version | Übereinstimmung der Dateierweiterung mit dem Dateityp erzwingen |
| Intune settings catalog | Force file extension to match file type (User) |
| Scope | User · HKCU |
| ADMX | excel16.admx · L_Forcefileextenstionstomatch |
Group Policy path
Registry
| Value | Data |
|---|---|
HKCU\Software\policies\microsoft\office\16.0\excel\security | |
| extensionhardening | 0 = Allow different · 1 = Allow different, but warn · 2 = Always match file type |
Not configured = the value does not exist – the application default applies and users may change the setting.
PowerShell
Check the current value (read-only)
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
$key = "$root\Software\policies\microsoft\office\16.0\excel\security"
foreach ($name in @('extensionhardening')) {
try { '{0} = {1}' -f $name, (Get-ItemPropertyValue -Path $key -Name $name -ErrorAction Stop) }
catch { '{0}: not configured' -f $name }
}Admin rights needed: HKCU\Software\Policies is read-only for standard users. An elevated session writes to the admin's own HKCU – to set it for another signed-in user, change $root to Registry::HKEY_USERS\<SID>.
Enable
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
try {
$key = "$root\Software\policies\microsoft\office\16.0\excel\security"
if (-not (Test-Path $key)) { New-Item -Path $key -Force -ErrorAction Stop | Out-Null }
New-ItemProperty -Path $key -Name 'extensionhardening' -PropertyType DWord -Value 0 -Force -ErrorAction Stop | Out-Null # options: 0 = Allow different, 1 = Allow different, but warn, 2 = Always match file type
'Done.'
}
catch { Write-Error "Failed: $($_.Exception.Message)" }Reset to Not configured
# --- Settings --- $root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>' $key = "$root\Software\policies\microsoft\office\16.0\excel\security" Remove-ItemProperty -Path $key -Name 'extensionhardening' -ErrorAction SilentlyContinue 'Policy values removed (Not configured).'
Intune (settings catalog)
Force file extension to match file type (User)
Settings catalog → Add settings → search for the name above.
Intune Settings Catalog Viewer ↗
Alternative: custom profile (OMA-URI)
| OMA-URI | ./User/Vendor/MSFT/Policy/Config/excel16v2~Policy~L_MicrosoftOfficeExcel~L_ExcelOptions~L_Security/L_Forcefileextenstionstomatch |
| Data type | String |
| Value | <enabled/> · <disabled/> |
This policy has options: add one <data id="…" value="…"/> per element after <enabled/>. The element IDs are in the ADMX file.
Cloud Policy
Cloud Policy (config.office.com → Customization → Policy Management) offers many user policies of the Microsoft 365 Apps – search for Force file extension to match file type. It also applies to unmanaged devices and wins over GPO and Intune for the same setting.
Microsoft 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.
Same category: Microsoft Excel 2016 › Excel Options › Security
- Perform file validation on pivot cachespivotoptions
- Turn off file validationenableonload
- Block Insecure Protocols in Excel Worksheet Functionsblockinsecureprotocolworksheetfunctions
- Scan encrypted macros in Excel Open XML workbooksexcelbypassencryptedmacroscan
- WEBSERVICE Function Notification Settingswebservicefunctionwarnings
All policies in this category · All 173 policies of excel16.admx