0

I'm working on a system where the users need to be able to upload an excel file to the server, then the system needs to process the excel file to load data into the XMPie uProduce system.

I already have it working to load CSV files into the system. I can confirm that the excel files have been uploaded to the server successfully. However, when my program then tries to access the excel file in order to read the data, it gets this error:

The Microsoft Jet database engine could not find the object 'Sheet1'. Make sure the object exists and that you spell its name and the path name correctly.

I am setting the filter as:

select * from [Sheet1]

I have also tried it as:

select * from [filename.xls]

Neither have worked. Does anyone have any suggestions what the SQL filter should be for pulling data from a database?

4

2 回答 2

2

尝试这个..

编写 Excel 查询与在任何其他传统数据存储(如 SQL Server、Oracle 等)中编写查询类似。但是有一些区别。首先,您必须指定工作表名称而不是表名称。接下来,您必须提供起始和结束单元格引用。仔细看我下面的代码:

选择 * 从 [用户 $A1:F500]

这里的用户是电子表格名称。

于 2013-03-19T01:10:55.900 回答
1

通过 ADO 或类似方法在 SQL 查询中指定 Excel 工作表名称时,您必须在工作表名称的末尾添加一个 $ 符号。尝试:

SELECT * FROM [Sheet1$]

更多信息在这里

于 2013-03-18T23:00:37.820 回答