what is the best way to upload an excel file [closed]

0

I must upload an excel file (office 2010 version) to a sql server database with a system created with asp.net (c # vs2012)

I've been seeing on the internet, and I'm a little dizzy because I've seen a lot of methods, but I do not know why to decide when to try an implementation. According to your experience, which method is the most recommended? angularjs ?, epplus ?, sheetjs? someone else to recommend?

Greetings and thanks for reading.

    
asked by Luis Gabriel Fabres 14.11.2018 в 19:10
source

1 answer

2

Being a web project, you have two options:

  • OleDb, that is, access Excel as if it were a database
  • Open XML-based library

The choice depends on the taste of each one, but there are limitations, with oledb maybe posting on web sites that are 64bit have problems, if you can use open xml

You could help with libraries such as ClosedXml

Finding and extracting the data

You will see how defining the range you can get a datatable with a few simple lines

 var companyRange = ws.Range(firstPossibleAddress, lastPossibleAddress).RangeUsed();
 var companyTable = companyRange.AsTable();

the datatable then you can iterate, validate I have been inserting it, or use the SqlBulkCopy , that's what you like

    
answered by 14.11.2018 / 19:51
source