Solved

Best way to import spreadsheet into Sql Server?

Posted on 2010-08-23
3
539 Views
Last Modified: 2013-11-27
I need users to upload a spreadsheet to my website (ASP.NET 4.0 framework), and then import the data from the spreadsheet into a SQL Server table.

I'll give them a template of the spreadsheet, so can control the spreadsheet's format.

What's the best approach to doing this? Should the spreadsheet be XLS, or CSV?

Also, most of the examples I've seen on the web rely on the old Microsoft.Jet.OLEDB.4.0, which I suspect I should avoid since it's deprecated. But is there another, better way? (I've seen Linq to Excel examples, but they all seem to rely on Excel being in XML format, and I was thinking native Excel would be more reliable and compact)
0
Comment
Question by:cdakz
  • 2
3 Comments
 
LVL 3

Expert Comment

by:ehartfield2002
ID: 33506696
If you can control the spreadsheet's format and specify a CSV file, then I'd say that's your best bet.  I say this mostly because CSV is platform neutral.  You aren't tied to any particular technology choice.

I have used OLEDB in the past when I had to consume a native Excel 97-2003 format.
0
 

Author Comment

by:cdakz
ID: 33506719
Is I use CSV, any suggestions no best way to read it? I expiremented a bit with OLEDB on my development machine, which is running Win 7 64 bit, and got an error. From my understanding, to get around this, I'll have to install OLEDB manually and then do some configuring to target 32-bit. All of which makes me leary for when the site is ultimately posted to the live server (initially shared Windows Server 2008, but likely moved to VPS Server 2008 soon after).
0
 
LVL 3

Accepted Solution

by:
ehartfield2002 earned 500 total points
ID: 33506759
If you do a Google search using the terms ".net read csv file", you'll see that there are many examples of how to do this that use .Net Base Class Library components.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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