Solve the error of Excel's "external form format" error
Question:
When using the connection string (including Microsoft.Jet.OLEDB.4.0 and Extended Properties = Excel 8.0), read the Excel (XLSX) file, if the file is not opened in Excel, the "external format does not match" may appear. mistake.
Solution:
In order to directly access the XLSX file without having to open it in Excel, please modify the connection string as follows:
"Microsoft.jet.OLEDB.4.0" was replaced with "microsoft.ace.OLEDB.12.0". This updated driver is compatible with Excel 2007 files.Update "Extended Properties = Excel 8.0" to "Extended Properties = Excel 12.0". This adjustment is consistent with the Excel version used.
Using this modified connection strings, you should be able to read the excel file without opening the file in the Excel in advance.
The above is the detailed content of How to Fix the 'External table is not in the expected format' Error When Reading xlsx Files in Excel?. For more information, please follow other related articles on the PHP Chinese website!