Issue while read Power view excel file using InterOp in c# RRS feed

  • Question

  • Hi,

    I have created one excel (xlsx) file with power view chart and saved it in one location. In c# by using Interop i want to read the xlsx excel file and update the chart dynamically. While my code executing physical file is opening from the location. Since Interop having open method only.

    How to over come it. I want to read excel file without open physically.

    Sample code which i am using.

    string workbookPath = "c:/SomeWorkBook.xlsx";
    Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath,
            0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
            true, false, 0, true, false, false);

    Thanks & Regards
    Suresh Sankaran
    • Moved by Patrick_Liang Thursday, May 21, 2015 4:36 AM Excel issue
    Wednesday, May 20, 2015 4:38 AM

All replies

  • Hello Suresh,

    Can you explain your requirement in detail.(like where the excel file would reside)

    since Excel.Workbook Open Method would only accept Physical file location. you can check for some other options like OpenXML or third party tool which might accept stream as input.


    Wednesday, May 20, 2015 5:06 AM
  • Hi Ram,

    I have created one excel 2013 xlsx file with power view chart.

    The xlsx file has two sheets which is, Data is available in one sheet and Power view chart is avail in another sheet. The power view chart would plot based on the data avail in the first sheet.

    I have placed this file anywhere in my system. (Physical file location). I would consider this xlsx file as a template for me.

    Dynamically I will write the data in the xlsx first sheet and do refresh the second power view sheet and do the save as in another location.

    While do this process the template excel file is opening. It should not happen.

    Hope you got my requirement.

    Thanks & Regards

    Suresh Sankaran

    Wednesday, May 20, 2015 5:26 AM
  • Hi,

    Thanks for posting in TechNet forum. This forum is for developers discussing developing issue about SharePoint. Since the issue is more relative to the Excel, I would like to move it to Excel for Developers forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact

    Thursday, May 21, 2015 4:35 AM
  • Hello Suresh,

    Consider using the Open XML SDK instead. See Welcome to the Open XML SDK 2.5 for Office for more information. Also you may third-party components designed for the server-side execution. 

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

    Read more about that in the Considerations for server-side Automation of Office article.

    Thursday, May 21, 2015 6:32 AM
  • Hi Suresh,

    >> How to over come it. I want to read excel file without open physically.

    As far as I know, if you want to read and write the data in Excel file, you need to open it, you could not operate it without opening. If you do not want the user see the Excel application, I suggest you hide it by setting the Application.Visible as false.

    # Application.Visible Property

    If I misunderstood you, please feel free to let me know.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 29, 2015 12:39 PM