Importing range of cells from Excel into SQL table

  • what is needed to import a range of cell data from Excel into a SQL table? i thought excel viewer would work so that i didn't have to load the full Excel version, but my import still didn't work.

  • Personally I think the easiest way is to save the excel file as a tab delimited .txt file somewhere on your server. Then use BCP with a format file to import the entire sheet into either a temp table or a permanent table if this is something you will be doing often. Look up BCP and Format File on BOL. Making the format file can be frustrating, so post back if you decide to go this route and want more specific help.

    Greg

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

  • thanks for you response.

    this is going to run everyday in the early morning so i have to schedule it to run. each day depending on the day of the week the range will be different. i will have to add this to a permanent table for history purposes.

    any other way?

    i don't have a problem using DTS to get a whole spreadsheet but a partial range is giving me trouble.

    thanks.

  • What error are you encountering? The issue that I have had in the past has been with the JET driver doing the import. The cells that were not importing correctly were numeric but some were blank. There is a parameter in the connection string when importing that tells the import to treat all data as text. This allows the data to be imported correctly. Read this article http://www.sqldts.com/254.aspx if this is the problem you are having.


    Karen Gayda
    MCP, MCSD, MCDBA

    gaydaware.com

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply