none
C# code to select data from unsaved excel file RRS feed

  • Question

  • I need to get data from excel file.(Real Time Data).

    Getting data from excel is simple and I know that.

    Is there any way to collect data from the unsaved excel file?

    Can anyone please help me?

    Wednesday, December 28, 2011 11:26 AM

Answers

  • You mean when Excel is running and the user has not saved it yet? If so yes, through interop. There are many walkthroughs, if you state what version of Office you are using, and which programming language you prefer, someone can link to an appropriate article.

    If you mean when the computer's crashed/shut down without the user saving, then you're probably stuck.

    Wednesday, December 28, 2011 12:13 PM

All replies

  • You mean when Excel is running and the user has not saved it yet? If so yes, through interop. There are many walkthroughs, if you state what version of Office you are using, and which programming language you prefer, someone can link to an appropriate article.

    If you mean when the computer's crashed/shut down without the user saving, then you're probably stuck.

    Wednesday, December 28, 2011 12:13 PM
  • Hi JosephFox,

    I am in same problem and i need a solution to do this.

    I am using VS 2010 using C#, .NET 4.0, and as desktop application to do this.

    and my Office version is Microsoft Excel 2010.

    please let me know if any solution is found.

    _______________

    Thanks in advance

    Tuesday, October 16, 2012 3:19 PM
  • There are lots of examples of general Excel C# automation if you google 'Excel C# interop'.

    The one thing that is not necessarily easy to find is attaching to an Excel instance that is already running (where the user has started excel). This may be what you want to do. In this case, instead of using the 'new' keyword to create a new instance of Excel, you attach to an existing version with:

    Excel.Application oExcelApp =  (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");

    If this doesn't help you sufficiently, I suggest you post your question(s) in a new thread, which will gather more interest.
    Tuesday, October 16, 2012 3:50 PM