Importing Excel Sheets to Access

  • Thread starter Thread starter Guest
  • Start date Start date
If you mean in "one" import process, the answer is you don't. You must do
multiple imports. You may be able to automate this by using a macro or VBA
code.
 
Ken said:
If you mean in "one" import process, the answer is you don't. You must do
multiple imports.

Are you sure? Try this:

INSERT INTO MyTable
(key_col, data_col)
SELECT DT1.key_col, DT1.data_col
FROM (
SELECT F1 AS key_col, F2 AS data_col
FROM [Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[Sheet1$]
UNION
SELECT F1 AS key_col, F2 AS data_col
FROM [Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[Sheet2$]
UNION
SELECT F1 AS key_col, F2 AS data_col
FROM [Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[Sheet3$]
) AS DT1;

Jamie.

--
 
Good suggestion, Jamie. Hadn't tried this before.
--

Ken Snell
<MS ACCESS MVP>



onedaywhen said:
If you mean in "one" import process, the answer is you don't. You must do
multiple imports.

Are you sure? Try this:

INSERT INTO MyTable
(key_col, data_col)
SELECT DT1.key_col, DT1.data_col
FROM (
SELECT F1 AS key_col, F2 AS data_col
FROM [Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[Sheet1$]
UNION
SELECT F1 AS key_col, F2 AS data_col
FROM [Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[Sheet2$]
UNION
SELECT F1 AS key_col, F2 AS data_col
FROM [Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[Sheet3$]
) AS DT1;

Jamie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top