Opening a spreadsheet downloaded from an online banking portal, reporting dashboard, CRM software, or email attachment in Microsoft Excel often triggers the warning prompt: The file format and extension of ‘[Filename].xlsx’ don’t match. The file could be corrupted or unsafe. Unless you trust its source, don’t open it. Do you want to open it anyway? Clicking ‘Yes’ can result in unformatted plain text, garbled XML markup, or blank cells. This error occurs because Microsoft Excel enforces file extension integrity checking. When an external web application exports a file labeled with an .xlsx or .xls extension while the underlying binary structure is actually HTML, XML, or comma-separated values (CSV), Excel halts opening to protect against spoofing attacks.
Eliminating this warning requires identifying the true underlying file format, adjusting Excel Trust Center settings, and converting files to authentic OpenXML spreadsheet formats.
Why Does Excel Flag Mismatched File Extensions?
Excel evaluates file header magic numbers before reading spreadsheet contents. Key causes of this extension warning include:
- Web Applications Exporting HTML or CSV as XLS: Many legacy CRM, banking, and ERP systems generate reports by wrapping tabular data in basic HTML
<table>tags and simply appending an.xlsor.xlsxextension. Excel detects HTML markup rather than binary BIFF or OpenXML ZIP archives, triggering the mismatch prompt. - Renamed Document Extensions: A user or script manually changed a
.csvor.tsvfile extension to.xlsxin File Explorer without converting the internal file structure. - Third-Party Email Gateway Scanning: Corporate email filters and antivirus scanners alter document headers or wrap attachments in quarantine metadata.
- Corrupted Office File Caches: Stale temporary files in the user AppData directory corrupt the internal file type association tables.
Method 1: Determine the True File Structure Using Notepad
Before attempting repairs, inspect the file’s raw header to determine its authentic format:
- Open File Explorer and locate the problematic file.
- Right-click the file and select Open with > Notepad (or another plain-text editor).
- Inspect the very first few characters at the top of the file:
- If the file begins with
<html>,<table>, or<!DOCTYPE html>, the file is an HTML document disguised as an Excel file. - If the file begins with plain comma-separated values without tags, it is a CSV file.
- If the file begins with
<?xml version="1.0"?>, it is an XML file. - If the file begins with the letters
PK, it is an authentic zipped OpenXML spreadsheet whose internal contents have suffered minor corruption.
- If the file begins with
- Close Notepad. Rename the file extension to match its true structure (e.g., change
report.xlsxtoreport.htmlorreport.csv). - Open the renamed file in Excel or your browser. If opened in Excel, go to File > Save As, select Excel Workbook (*.xlsx) from the dropdown, and save a clean, genuine spreadsheet file.
Method 2: Unblock the File in Windows File Properties
Files downloaded from internet gateways are quarantined with the Mark of the Web (Zone.Identifier):
- Right-click the affected spreadsheet and select Properties.
- At the bottom of the General tab, look for the Security section displaying: This file came from another computer and might be blocked to help protect this computer.
- Check the box for Unblock.
- Click Apply, then click OK.
- Double-click the spreadsheet to test opening it in Excel.
Method 3: Configure Protected View in Excel Trust Center
If you regularly download automated accounting or CRM exports that generate this alert:
- Launch Microsoft Excel.
- Click File > Options in the bottom-left corner.
- Select Trust Center in the left pane and click Trust Center Settings….
- Click Protected View on the left.
- Temporarily uncheck Enable Protected View for files originating from the Internet and Enable Protected View for files located in potentially unsafe locations.
- Click OK on all dialogues and restart Excel.
- Security Recommendation: Instead of permanently disabling Protected View, consider adding your primary downloads folder to Trusted Locations in the Trust Center to maintain security against external phishing files.
Method 4: Change Registry Extension Hardening Settings
For enterprise environments running automated reporting software, you can configure Excel to suppress extension mismatch prompts globally via the registry:
- Press Windows Key + R, type
regedit, and press Enter. - Navigate to:
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security - Right-click in the right pane, choose New > DWORD (32-bit) Value.
- Name the value:
ExtensionHardening - Double-click
ExtensionHardeningand set its value:0: Never check file extensions and suppress all warning alerts.1: Check extension but open files without warning if a mismatch occurs.2: Default behavior (strict check and display warning).
- Set the value to
1for a balance of convenience and stability, click OK, and restart Excel.