Exception from HRESULT: 0x800A03EC Error
Got same error in this line
Object temp = range.Cells[i][0].Value;
Solved with non-zero based index
Object temp = range.Cells[i][1].Value;
How is it possible that the guys who created this library thought it was a good idea to use non-zero based indexing?
This is a common but poorly documented Excel COM Error. I've seen it documented as "NAME_NOT_FOUND", meaning that Excel's COM layer is disabled, and can't find the COM property or method name.
I get this error consistently when running the COM code while Excel is 'busy', for example if you set a timer that will start the code, and the code starts running while the user is editing a cell or pressing down their mouse button, then you'll always get this error. This error only happens when the code runs on the main Excel thread, but seems to be the equivalent of error VBA_E_IGNORE = 0x800AC472, which you get when calling the Excel COM object model from another thread, while Excel is 'busy'.
The only workaround seems to be to retry (with some small delay) the COM call until it succeeds - when Excel is no longer 'busy'.
Check your start indexes. Its start from 1 not 0 for Microsoft.Office.Interop.Excel range objects. I had received same error because of my loop start value.