Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I try to open the Excel file by this code.But i got an error like this

Microsoft Excel cannot access the file 'C:\XXXXExcel.xlsx'. There are several possible reasons:

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.

Plz help me..

Microsoft.Office.Interop.Excel.Workbook workBook = app.Workbooks.Open(FilePath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
share|improve this question
    
In what context is this code running? Within a web part, a feature, a timer job? Where is the excel file you are trying to open? Please provide more detail. –  James Love Jan 4 '13 at 21:19
    
How is this related to SharePoint? –  ToddersLegrande Jan 4 '13 at 21:26
add comment

1 Answer 1

Varna,

have a look at the OpenXML SDK. See link for examples of what you can do

Great video that explains using of Open XML sdk and also has example of using it with SharePoint

Source: Interacting with Excel spreadsheet from Sharepoint 2010

However, your answer accept rate is quite low! Please accept it if it resolves your issue!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.