How to Fix Excel External Table Is Not in Expected Format Error

Connecting an Excel workbook to an external data source, executing a VBA macro, or importing data via Power Query or Microsoft Access Database Engine only to encounter the runtime error “External table is not in the expected format” halts reporting automation. This error occurs when the Microsoft Access Database Engine (ACE.OLEDB) attempts to query an encrypted, password-protected workbook, when file extensions (.xls vs .xlsx) mismatch the internal binary structure, or when obsolete 32-bit ACE drivers cannot parse modern OpenXML schemas. Follow this guide to resolve data connection format mismatches.

Verify File Extension vs True Internal MIME Format

Renaming an older Excel 97-2003 binary file (.xls) by simply typing .xlsx at the end of the filename does not alter its internal file structure. When OLEDB drivers inspect the file headers, they reject the invalid format.

  1. Open the target source spreadsheet directly in Microsoft Excel desktop.
  2. If Excel displays a warning stating “The file format and extension of [File] don’t match”, click Yes to open it.
  3. Click File > Save As.
  4. In the Save as type dropdown, explicitly select Excel Workbook (*.xlsx).
  5. Save the file under a clean name.
  6. Update your Power Query, SQL, or VBA connection script to point to this genuine OpenXML workbook.

Remove Password Protection and Encryption

Standard OLEDB and ACE connection strings cannot authenticate workbooks protected by modern Office AES encryption without specialized credentials.

  1. Open the source file in Excel.
  2. Go to File > Info > Protect Workbook.
  3. Click Encrypt with Password.
  4. Clear all characters from the password field and click OK.
  5. Save the workbook. Removing encryption allows the external database engine to parse workbook table structures without throwing format errors.

Install the Updated Microsoft Access Database Engine Redistributable

If your script queries modern .xlsx or .xlsb files using legacy Jet drivers, upgrading to the modern Access Database Engine restores driver compatibility.

  1. Download the official Microsoft Access Database Engine 2016 Redistributable from Microsoft.
  2. Ensure you match bitness: if running 64-bit Office, install the 64-bit redistributable (accessdatabaseengine_X64.exe).
  3. In your connection string, ensure the provider specifies the modern ACE driver rather than obsolete Jet:
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Data\Source.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES;";
  4. For macro-enabled workbooks (.xlsm), set Extended Properties to "Excel 12.0 Macro;HDR=YES;".

Repair Corrupted Source Workbooks

If an automated system generated the source spreadsheet with malformed XML tags, running Excel built-in document repair rebuilds valid schema tables.

  1. Launch Excel and click File > Open > Browse.
  2. Select the corrupted source workbook.
  3. Click the small arrow next to the Open button at the bottom right of the dialogue box.
  4. Select Open and Repair….
  5. Click Repair to salvage damaged data tables.
  6. Save the repaired workbook and re-execute your external data query.

Get the best tech tips delivered straight to your inbox.

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