I wrote a tool to generate SQL scripts based on the Excel Data dictionary, and encountered some minor problems during the process.
Cannot read data cells in Excel. Data is available, but all read results are null.
Solution:
1. in the import data connection string, add IMEX = 1, "provider = Microsoft. jet. oledb.4.0; Data Source = "C: \ data.xls"; extended properties = "Excel 8.0; HDR = yes; IMEX = 1.
Note:
IMEX = 1: Mixed Mode
HDR = yes; whether to use the first row as the column header
Both must be used together.
I thought it would be okay. However, in actual use, this setting still does not work. After reading a lot of information, we found that there was another information in the registry that needs to be modified, in this way, the content of the first eight rows can no longer be used in Excel to determine the type of the column.
Modify the Registry as follows:
There is a typeguessrows value in HKLM \ Software \ Microsoft \ jet \ 4.0 \ engines \ excel. The default value is 8, indicating that the first eight columns will be read to determine the type of each column, therefore, if the first eight columns of data are all numbers, the text that appears after the first eight columns will become null. To solve this problem, you only need to change the typeguessrows server code value to 0, you can solve this problem!