Import Excel spreadsheet into MS Access Database

2019-06-14 01:50发布

问题:

Similar to this post I need to import data from excel spreadsheet to a new access table using a query

Is there something similar to this query for importing to access database

INSERT INTO [tblTemp] ([Column1], [Column2], [Column3], [Column4])

SELECT A.[Column1], A.[Column2], A.[Column3], A.[Column4]
FROM OPENROWSET 
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\Excel.xls;HDR=YES', 'select * from [Sheet1$]') AS A;

回答1:

You can use query like this:

SELECT [Column1], [Column2], [Column3], [Column4] 
INTO [tblTemp] 
FROM [Worsheet1$A2:D122] IN 'D:\Excel.xls' [Excel 8.0;HDR=YES;IMEX=0] 
WHERE [Column1] is Not Null;