Import excel spreadsheet into SQL 2005 using Visual Studio 2008

Posted on 2009-12-22
Last Modified: 2013-11-26
I need to find a way to import an excel spreadsheet into an SQL 2005 table.  I am developing a VB.NET application in Visual Studio 2008.  Can anyone give me some advice on how to accomplish this?
Question by:schwientekd
    LVL 96

    Accepted Solution

    It is possible to use OLE DB to read the data from Excel, and then use an SqlBulkCopy to bulk insert the records into the SQL Server table.

    Read Data from Excel using OLEDB in VB.NET 2005

    The SqlBulkCopy class

    Author Closing Comment

    I used the first link to import the spreadsheet data into a DataGridView and instead of a bulk insert I wrote a For Each loop to insert each row into the table.
    LVL 96

    Expert Comment

    by:Bob Learned
    The bulk insert is optimized over a For Each loop, so you might want to investigate it for the future, and see if it is faster...

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
    In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now