Excel Package exception: Object reference not set to an instance of an object.

Sep 16, 2009 at 7:26 PM


I tried this excel package by incorporating the dll to my project. It's working fine for read. But when i try to update the excel file and save it, it throws an exception:"Object refernce not set to an instance of an object. can anybody help me out? Follwing is my code:

<font size="2" color="#2b91af"><font size="2" color="#2b91af">


</font></font><font size="2" color="#2b91af">



existingFile = new FileInfo(@"C:\Testing.xlsx");

using (ExcelPackage xlPackage = new ExcelPackage(existingFile))



// get the first worksheet in the workbook

ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[1];

worksheet.Cell(1, 1).Value ="Testing";

<font size="2">



 xlPackage.Save();  // here it gives me an error: object reference not set to an insatnce of an object.<font size="2">


PLs help me out. Thanks.



Oct 1, 2009 at 5:04 AM

see http://excelpackage.codeplex.com/Thread/View.aspx?ThreadId=7005