Skip to content

Instantly share code, notes, and snippets.

@toinetoine
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toinetoine/816f75d62fcec9ee73a9 to your computer and use it in GitHub Desktop.
Save toinetoine/816f75d62fcec9ee73a9 to your computer and use it in GitHub Desktop.
Printing cell A1 from an excel sheet named 'Sheet1' of the workbook 'ExcelWorkbook.xlsx' using Koogra in .NET
/*
* Must have refrences the dlls:
* Net.SourceForge.Koogra.dll (here: http://www.antoinedahan.com/blog/ReadingExcelFilesWithKoogra/Net.SourceForge.Koogra.dll)
* Ionic.Utils.Zip.dll (here: http://www.antoinedahan.com/blog/ReadingExcelFilesWithKoogra/Ionic.Utils.Zip.dll)
*/
using Koogra = Net.SourceForge.Koogra;
//Grab the workbook
Koogra.IWorkbook workbook = Koogra.WorkbookFactory.GetExcel2007Reader("ExcelWorkbook.xlsx");
//Grab the worksheet
Net.SourceForge.Koogra.IWorksheet worksheet = workbook.Worksheets.GetWorksheetByName("Sheet1");
//Write the contents of cell A1 (at row index 0 and cell index 0)
Console.Write((string)(worksheet.Rows.GetRow(0).GetCell(0).GetFormattedValue()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment