Import Excel sheet into SQL Server through file upload in asp.net

14,886

I use this library to import xlsx files after upload.

https://exceldatareader.codeplex.com/

Does this help?

Share:
14,886
CHash_Mike
Author by

CHash_Mike

I am hard core C# developer and love to write complex algorithms in C#

Updated on June 05, 2022

Comments

  • CHash_Mike
    CHash_Mike almost 2 years

    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.