I’m trying to read excel file which is uploaded on itemadded event. I need to update meta data column of document library by reading uploaded excel sheet. But I get following error,

Here is my code,
SPItem item = properties.ListItem;
string workbookpath = "http://server/sites/dev/Published%20documents/Test.xlsx";
ApplicationClass excel = new ApplicationClass();
excel.Visible = false;
Workbook excelWorkBook = excel.Workbooks.Open(workbookpath, 0, true, 5, "", "", false, XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Sheets sheets = excelWorkBook.Worksheets;
Worksheet worksheet = (Worksheet)sheets.get_Item(1);
Range range = worksheet.get_Range("A1", "A1");
item["Status"] = (string)range.Cells.Value2;
item.Update();
base.ItemAdded(properties);
For testing purpose I’ve hard coded the excel file path.
Take a look at this blog post. I think it will help
http://hristopavlov.wordpress.com/2008/05/14/uploading-a-file-event-receivers-the-file-has-been-modified-by/