What is the appropriate technology for transferring data to an Excel spreadsheet using a formula from a .NET source?

I would like to be able to allow the user to enter a custom formula in a cell in Excel, which will subscribe to the data provided by an external .NET application. For example, a user might enter ...

=getCurrentValue("ABC") 

There is an external .NET application (C #) that determines the value of "ABC" every minute.

The cell should display the initial "ABC" value from the external application and update when the external application sends the new value.

In the past, I think the external application will be a DDE server, and the formula will be a DDE client, but DDE seems to be dead. What β€œright” technology is used for this?

Please note that the spreadsheet must retrieve the data using the formula The information is not included in the file with the corrected template, but in any spreadsheet into which the user enters the formula.

Thanks,

John

+6
source share
2 answers

Excel RTD (Real-Time Data) replaces DDE. It allows you to pass values ​​to a cell whenever updates are available. If the process providing the updates is an external application, setting up a WCF channel between the RTD server and the external application will allow you to transfer real-time updates to Excel.

Here are some links:

+5
source

You can contact Excel worksheets through Excel Api:

new Microsoft.Office.Interop.Excel.Application();

-1
source

Source: https://habr.com/ru/post/910950/


All Articles