How to Fix ‘The File Format and Extension of [File] Don’t Match’ in Microsoft Excel

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 .xls or .xlsx extension. 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 .csv or .tsv file extension to .xlsx in 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:

  1. Open File Explorer and locate the problematic file.
  2. Right-click the file and select Open with > Notepad (or another plain-text editor).
  3. 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.
  4. Close Notepad. Rename the file extension to match its true structure (e.g., change report.xlsx to report.html or report.csv).
  5. 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):

  1. Right-click the affected spreadsheet and select Properties.
  2. 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.
  3. Check the box for Unblock.
  4. Click Apply, then click OK.
  5. 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:

  1. Launch Microsoft Excel.
  2. Click File > Options in the bottom-left corner.
  3. Select Trust Center in the left pane and click Trust Center Settings….
  4. Click Protected View on the left.
  5. Temporarily uncheck Enable Protected View for files originating from the Internet and Enable Protected View for files located in potentially unsafe locations.
  6. Click OK on all dialogues and restart Excel.
  7. 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:

  1. Press Windows Key + R, type regedit, and press Enter.
  2. Navigate to:
    HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security
  3. Right-click in the right pane, choose New > DWORD (32-bit) Value.
  4. Name the value:
    ExtensionHardening
  5. Double-click ExtensionHardening and 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).
  6. Set the value to 1 for a balance of convenience and stability, click OK, and restart Excel.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.