我下载了一个 XLS 电子表格,并尝试将其导入到 .net 数据表中。表结构如下:
(没有名称的日期列)、流入 (kWh)、流出 (kWh)、库存 (kWh)
连接字符串是:
" Provider=Microsoft.Jet.OleDb.4.0;Data Source=sheet.xls;Extended Properties="Excel 8.0;IMEX = 1"
不起作用的事情:
- "SELECT * FROM [Sheet1$]" selects: NoName, Inflow_(kWh), Outflow_(kWh) and the last column is missing
- "SELECT [Stock (kWh)] FROM [Sheet1$]" returns: "No value given for one or more required parameters."
- "SELECT [Stock_(kWh)] FROM [Sheet1$]" returns: "No value given for one or more required parameters."
- "SELECT * FROM [Sheet1$A:D]" Selects: NoName, Inflow_(kWh), Outflow_(kWh) and the last column is missing
有效但不是解决方案的事情:
- "SELECT * FROM [Sheet1$D:D]" Selects: Stock_(kWh) but all other columns are missing
如果我在下载文件后在 Excel 中打开文件(不保存)然后尝试导入它,那么它可以工作。
Excel 互操作工作
有任何想法吗?任何人?