3

I am designing for a requirement which would provide user with an asp.net upload control to upload excel file(xls/xlsx/any advanced format) and load this excel data to SQL server 2008 data table with custom column mapping.

On internet I have found many blogs to implement this functionality using Jet OLEDB provider but there are some limitation to this functionality as below -

  1. The data is truncated for the data after first few rows in the table - Reasone is Jet provider checks initial few rows to decide on the data type and its size. Resolution that I found for this is go to Registry and change the value for "TypeGuessRows". My question is - Is this advisable to do this on the web server in case of asp.net application

  2. Unicode characters does not get imported correctly - This issue can be resolved by changing the connection string to add "CharacterSet=65001;" as per link UnicodeCharacters

Again question is whether this would be advisable and full proof solution.

What is the best way to implement Import Excel to SQL Server 2008 for huge data intensive excel to be imported to Database without loosing any data and unicode characters?? The solution should be compatible with Excel 2003/2007/2010/2013.

2
  • stackoverflow.com/questions/19074521/… Commented Dec 31, 2013 at 8:54
  • Hi Nagraj, thanks for the link, however I am not importing image to database Commented Dec 31, 2013 at 9:20

2 Answers 2

2

I use this library to import xlsx files after upload.

https://exceldatareader.codeplex.com/

Does this help?

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Nickand, I am using ClosedXML library similar to this one, however I am still doubtfull whether this would work for above to problems I pointed in question. I tested with basic scenarios and it works falwlessly. How is your experience with this library?
I looked at Closedxml and didnt need a excel writer so decided on exceldatareader. It handles the job well, imports about 200,000 lines regularly but havent tried unicode characters yet. Can be put into a dataset or each row handled.
0

You could help you. https://freenetexcel.codeplex.com

 Workbook workbook = new Workbook();

 workbook.LoadFromFile(@"..\..\parts.xls",ExcelVersion.Version97to2003);
 //Initialize worksheet
 Worksheet sheet = workbook.Worksheets[0];

 DataTable dataTable = sheet.ExportDataTable();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.