Importing from Excel by cell

G

Guest

I have an excel file which contains data in non-contiguous cells. I want to
import data from these cells (which amounts to multiple ranges) to a
temporary table in access which would then feed into update queries. Is
there a way to designate multiple ranges:
DoCmd.TransferSpreadsheet acImport, , "TempImport", "C:\flight.xls",
False, "D3 And G3" or something to that affect?
 
J

John Nurick

No, you can't import from a non-contiguous range.

You can import non-contiguous columns from a contiguous range by using a
query with syntax like this:

INSERT INTO MyExistingTable
SELECT F1, F3, F5
FROM [Excel 8.0;HDR=No;database=D:\File.xls;].[Sheet1$A1:E100]
;

and you can import from one-cell ranges using the same syntax.

Or you could add a sheet to the workbook which brings the scattered
values into a contiguous and importable range.
 

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

Top