After a workbook is opened, how can it be closed/disposed

I’ve opened a workbook, done some things with the data etc. Now I just want to close / dispose of the workbook and worksheet objects. Neither of the objects has a .Close() or .Dispose() method. I must be missing something basic here.

I don’t want to Save the workbook.


Hi Lindsey,

There are no Close and Dispose methods because the whole workbook is read with ExcelFile.Load method, there is no reference to the Excel file that is being kept open.
In other words, there are no unmanaged resources that need to be disposed.

To have those changes appear in your original Excel file, you need to use ExcelFile.Save method.