![]() XDocument document = workbookNameSpace = Get worksheet ![]() Ref for writing a Excel spreadsheet: public void ReadExcelCellTest() ![]() Ref for reading from Excel: (please do more research to find other examples) Note: Office 2003 is a minimum requirement for this to fly: Its likely to cost you more in the long run - eg we had a SSIS job calling a Stored Procedure with the OleDB reading an excel file in the sptroc and kept crashing the SQL box! I took the OleDB stuff out of the sproc and it stopped crashing the server.Ī better method I've found is to do it with Office 2003 and the XML files - in respect of Considerations for server-side Automation of Office. I would urge against using OleDB, especially if its going to be run on a server. It only support Excel 97-2003 (xls) files.Īn extension to ExcelPackage. In addition to Excel (97-2010) it also supports Word and PowerPoint files. It is also easy like the other ones I've mentioned. There is another project, ExcelDataReader, that seems to have the ability to handle both formats. get the first worksheet in the workbookĮxcelWorksheet worksheet = Ĭonsole.WriteLine("Cell( // the using statement calls Dispose() which closes the package. Sample using ExcelPackage: using (ExcelPackage xlPackage = new ExcelPackage(existingFile)) Var content = sheet.getCell(colIndex, rowIndex).getContents() Sample using CSharpJExcel: Workbook workbook = Workbook.getWorkbook(new System.IO.FileInfo(fileName)) They have absolutely no dependency on anything. I highly recommend CSharpJExcel for reading Excel 97-2003 files (xls) and ExcelPackage for reading Excel 2007/2010 files (Office Open XML format, xlsx).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |