Importing from Excel

lovemuscle2005

Board Regular
Joined
Dec 28, 2004
Messages
99
I have a regular import from excel going into an access table.

My problem is that the excel file has more culumns in than I want to import, so I want to be able to choose which, i.e. A,B,E,G,H.

Is there a way anyone knows?

Thanks in advance

:LOL:
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
When you use the import wizzard, there is a check box for "do not import this field" (about 3 pages in on the wizzard). You can highlight a field and the click to not import that field. Just move to through each field before you click "next" on the wizzard.

me2
 
Upvote 0
You could create an import specification that imports the fields that you want as the data type you want.

This can then be used in code.

Goto Advanced... in the Import Wizard when you manually do the import.
 
Upvote 0
Well goto File>Get External Data... and select the Excel file.

Follow the steps to import the required columns only.

Before you hit finish click Advanced...

Now make any other adjustments to the import.

Then save the specification with a relevant name.

You should then be able use this specification when importing using code.

I can't access Access at the moment so can supply the syntax but you should find it in the help file.
 
Upvote 0
Use a named range in Excel and only import that - don't import a worksheet. Non-contiguous ranges are allowed in Excel (e.g. columns A,B,E,G,H only). If you're queasy doing that, you can construct a redundant set of the data in a rectangle - e.g. insert a new sheet where A1=Sheet1!A1, B1=Sheet1!B1, C1=Sheet1!E1, etc. and again define a range appropriately.

You can also link to Excel instead of importing - again, directly to a named range. Linking would be one-time-only vs. importing every time the data changes, if that fits your scenario. You said it is a "regular import" so I thought I'd mention this.
 
Upvote 0

Forum statistics

Threads
1,221,905
Messages
6,162,772
Members
451,786
Latest member
CALEB23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top