Last post Jan 22, 2015 10:11 PM by Zhi Lv - MSFT
Jan 22, 2015 01:18 PM|teahou|LINK
I am building an MVC app. I created a feature to upload and save an excel file, but I can't figure out the best way to save the data to my sql server database. My research has shown 4 or 5 different technologies, and I can't decide on the best one for
I am only accepting .xlsx files. The excel file can have many sheets, but in every file one of the sheets will be named something common, so I will need to open the file and search the sheet names for my sheet. The sheet will have headers, and they should
be uniform but I cant guarantee it, so I need to be able to search the headers on the found sheet. I then need to iterate through and save each row to the database. Oh, and during the iteration process I need to compare the Itemid column on the excel sheet
to the itemid column in the database so no duplicates get saved.
I have looked at NPOI, OpenXML & Interop. I have found various code snippets for the various libraries, but I can't find a full tutorial.
Jan 22, 2015 10:11 PM|Zhi Lv - MSFT|LINK
As for this issue, when you import data from excel to SQL server, at first, you need to create data table according to the excel sheets. Here are some articles about import
data from Excel file to Database table in MVC. Please refer to them.