Here i will show how to reading the of excel file which is in Document library.The "url" is the path of excel file in library .To do the excel application process we have to add the Microsoft.Interop.Excel.dll.Then get the data form the file and transfer to values.
ApplicationClass Mexcel = new ApplicationClass(); string wbPath = url; Workbook Workbook = Mexcel.Workbooks.Open(wbPath, 0, false, 5, "", "", false, XlPlatform.xlWindows, "\t", true, false, 0, true, 0, 1); Sheets ss = Workbook.Worksheets; Worksheet ws = (Worksheet)sts.get_Item(1); for (int i = 1; i <= ws.Rows.Count; i++) { Range rn= worksheet.get_Range("C" + i.ToString(), "F" + i.ToString()); var values = (System.Array)range.Cells.Value2; }
No comments:
Post a Comment