Import an Excel sheet into a SQL Server Table

I'm using the Import Wizard to import an Excel sheet into SQL Server 2008.
I don't want to import all the fields from the sheet.

There is an option  "Write a query to specify the data to transfer". But not sure if I can use it with the Excel sheet.
I tried "Edit Mapping . ." but you can't change anything there. "Edit SQL" is greyed out also.
Also it's importing all the number fields as "float".

I basically just want to Import 3 fields from the Excel Sheet and make a table in SQL Server.
Is there another or better way of doing this? thanks
LVL 16
Who is Participating?
Tony BarkdullConnect With a Mentor Commented:
eliminate the extraneous data from the Excel sheet prior to importing it.
mmr159Connect With a Mentor Commented:
Create a copy of the spreadsheet, remove the extra data, save-as CSV, then use the bulk copy program.
MikeMCSDAuthor Commented:
I forgot to mention that I have to do this once a week, maybe twice.
I could delete the columns, but I was hoping to make this as automated as possible.

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

There are several ways to do this in an automated fashion.  I believe one or more of the options listed here should provide you with what you need.

They vary in their execution.  Give it a quick read to determine which would be best in your situation.  If you need help with one, let us know.
Anthony PerkinsCommented:
You are going about it the wrong way.  Import the spreadsheet with all the columns and all the rows into a staging table.  When that is done you can:
1. Validate the data.
2. Import the data in your staging table into your production table making any necessary conversions and/or transformations.
MikeMCSDAuthor Commented:
>> Import the spreadsheet with all the columns and all the rows into a staging table.

When I use the Import wizard, it creates a table. Is that the stagging table?
Anthony PerkinsCommented:
>>Is that the stagging table?<<
It could be.
Anthony PerkinsConnect With a Mentor Commented:
A staging table is just a scratch/temporary table that you use over and over again, by first deleting all the data before importing a new file.
MikeMCSDAuthor Commented:
I'm having trouble with one of the fields in the Import. It fails and  I get this message :

 The "output column "Product Description" (24)" failed because truncation occurred, and the truncation row disposition on "output column "Product Description" (24)" specifies failure on truncation.

I have that column marked as "Not Mapped" too.
I tried making the field  nvarchar(MAX) but that didn't help either.
Why is it doing this even though it is marked as not mapped?

If I go in the sheet and delete that whole columns data, it works.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.