Answered by:
reading from excel Best approach in .net

Question
-
User2060565753 posted
I know approaches like oledb, Excel object model.
Wanted to know whats the best approach
Monday, June 3, 2013 6:34 AM
Answers
-
User269602965 posted
OLEDB is fine way to go, but sometimes you get unexpected results and may have to modify (prepare) your data on the Excel side or handle a data transformation on the .NET side. The main issue is what you see in a spreadsheet is a FORMAT and not what Excel may be storing in the background and exports to OLEDB. Search this Forum for Excel and OLEDB keywords and you will get an understanding of some recurring issues.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, June 3, 2013 11:03 PM
All replies
-
User1648350404 posted
You might want to see following:
http://stackoverflow.com/questions/12996234/optimal-way-to-read-an-excel-file-xls-xlsx
http://stackoverflow.com/questions/14261655/best-fastest-way-to-read-an-excel-sheet-into-a-datatable
Monday, June 3, 2013 6:45 AM -
User150726824 posted
http://www.codeproject.com/Tips/509179/Read-Excel-File-into-DataSet-in-ASP-NEhT-Using-Csha
best i guess would be take all data in datatable or dataset
using DataReader after that start exploring whatever you wish to do.
Monday, June 3, 2013 7:23 AM -
User2060565753 posted
So should i conclude that OLEDB is best way?
Monday, June 3, 2013 8:59 AM -
User269602965 posted
OLEDB is fine way to go, but sometimes you get unexpected results and may have to modify (prepare) your data on the Excel side or handle a data transformation on the .NET side. The main issue is what you see in a spreadsheet is a FORMAT and not what Excel may be storing in the background and exports to OLEDB. Search this Forum for Excel and OLEDB keywords and you will get an understanding of some recurring issues.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, June 3, 2013 11:03 PM -
User2060565753 posted
OLEDB is fine way to go, but sometimes you get unexpected results and may have to modify (prepare) your data on the Excel side
-- can you highlight more or share links?
Tuesday, June 4, 2013 5:28 AM -
User269602965 posted
You format a DATE in Excel like '01 Jan 2013' and in the background, Excel stores it as integer, and you might get the integer instead of the formatted date. similar things can happen with other "formatted" excel cells, like NUMBER formatting. When/if these happen you have to handle it on the excel side or transform it on the .NET side before putting into a data grid.
Thursday, June 6, 2013 11:46 AM