How do I read data from an Excel Spreadsheet with C#?? Please Help!
-
Hi, I am trying to read data from an Excel spreadsheet :confused: which contains data with which I want to perform string manipulation and then save to SQL srvr.. any advice and help will be greatly appreciated. :) all the data in the spreadsheet are of a string data type.. Thanks Afzal Hassen
-
Hi, I am trying to read data from an Excel spreadsheet :confused: which contains data with which I want to perform string manipulation and then save to SQL srvr.. any advice and help will be greatly appreciated. :) all the data in the spreadsheet are of a string data type.. Thanks Afzal Hassen
Hi, if u want to retrieve data using OLEDB Object than this link will help u. http://support.microsoft.com/default.aspx?scid=kb;en-us;316831[^] else u if u want to read data cell wise u can use...........
Dim exlApp As New Excel.Application() Dim exlBook As Excel.Workbook = exlApp.Workbooks.Open(tbFileName.Text.Trim) Dim exlSheet As Excel.Worksheet = exlBook.Worksheets.Item(tbWorkBook.Text.Trim) for intCounter = 1 to TotalRows strFirstColValue= exlSheet.Cells.Range("A1" & intCounter).Value 'after reading values u can insert these into Datatable using New dataRow....\ next
I hope this will help u................:-> Regards, Ritesh -
Hi, if u want to retrieve data using OLEDB Object than this link will help u. http://support.microsoft.com/default.aspx?scid=kb;en-us;316831[^] else u if u want to read data cell wise u can use...........
Dim exlApp As New Excel.Application() Dim exlBook As Excel.Workbook = exlApp.Workbooks.Open(tbFileName.Text.Trim) Dim exlSheet As Excel.Worksheet = exlBook.Worksheets.Item(tbWorkBook.Text.Trim) for intCounter = 1 to TotalRows strFirstColValue= exlSheet.Cells.Range("A1" & intCounter).Value 'after reading values u can insert these into Datatable using New dataRow....\ next
I hope this will help u................:-> Regards, RiteshThat looks like VB code. That'd be fightin' talk 'round here, pardner. ;P
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More