Click here to Skip to main content
16,022,333 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I want a program to read excel data and dump into my desired database, is there anybody to help me about this
Posted

See here[^].
 
Share this answer
 
You can retrieve data from Excel file:
using Microsoft.Office.Interop.Excel;

Application ExcelObj = new Application();
            Workbook theBook = ExcelObj.Workbooks.Open(@"F:\TEMP\1.xlsx", 0, true, 5,"", "", true,Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false,0, true,null,null); 
            Sheets sheets =theBook.Worksheets;

            Worksheet theSheet = (Worksheet)sheets.get_Item(1);
            Range range = theSheet.get_Range("A1", "A6");

            Array myvalues = (Array)range.Cells.Value2;
            foreach (object o in myvalues)
            {
                Console.WriteLine(o);
            }

and then write it to your DB
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900