Importing an Excel WorkSheet into a Datatable
Posted
by Nick LaMarca
on Stack Overflow
See other posts from Stack Overflow
or by Nick LaMarca
Published on 2010-05-13T15:13:15Z
Indexed on
2010/05/14
13:04 UTC
Read the original article
Hit count: 295
I have been asked to create import functionality in my application. I am getting an excel worksheet as input. The worksheet has column headers followed by data. The users want to simply select an xls file from their system, click upload and the tool deletes the table in the database and adds this new data.
I thought the best way would be too bring the data into a datatable object and do a foeach for every row in the datatable insert row by row into the db.
My question is what can anyone give me code to open an excel file, know what line the data starts on in the file, and import the data into a datable object?
© Stack Overflow or respective owner