Solved

Best way to import spreadsheet into Sql Server?

Posted on 2010-08-23
3
531 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

14 Experts available now in Live!

Get 1:1 Help Now