using System.Windows.Form;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
namespace WindowsFormsApplication4
public partial class Form1 : Form
private void button1_Click(object sender, EventArgs e)
Excel.Application xlApp ;
Excel.Workbook xlWorkBook ;
Excel.Worksheet xlWorkSheet ;
xlApp = new Excel.Application();
xlWorkBook = xlApp.Workbooks.Open(@"C:\Users\vimuthukrishnamoorth\Documents\vishnu");
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
range = xlWorkSheet.UsedRange;
cl = range.Columns.Count;
for (rCnt = 1; rCnt<= rw; rCnt++)
for (cCnt = 1; cCnt<= cl; cCnt++)
str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
xlWorkBook.Close(true, null, null);
Marshal.ReleaseComObject(xlWorkSheet);
Marshal.ReleaseComObject(xlWorkBook);
Marshal.ReleaseComObject(xlApp);