Reference: I've looked at the posting Open excel file with Mathematica.

My intention is to be able to use Excel's RTD capability in order to pull market data into Mathematica. To my knowledge, this can be done, at the least, by having Excel use the RTD link, then using NETLINK to grab the value from Excel. At some point, it would be nice to have Mathematica pulling real time data from an Excel RTD link, but for now the RTD link value is only updated once per day.

PullValue[file_String] :=
  Module[{excel, workbook, worksheet, RTDvalue},
    excel = CreateCOMObject["Excel.Application"];
    If[! NETObjectQ[excel], Return[$Failed], excel[Visible] = True;
     workbook = excel@Workbooks@Add[];
     worksheet = workbook@Worksheets@Item[1];
     worksheet@Range["A1"]@Value = 
     RTDvalue = worksheet@Range["A1"]@Value;

outputfile = "C:\\Temp\\demo.xlsx";

The =ProphetX|QUOTE!'@CT@A?SettlementPrice' is the RTD portion, which at this point is putting a value into the saved Excel file, which should be correct. Sometimes when dealing with RTD links, I've noticed that I need to use FormulaArray, but @value seems to be working fine here.

Print[RTDvalue] is outputting -2146826246, instead of the correct value of ~ 81.26

So, I am wondering how I can get those values RTD values, which have gone into an Excel cell, into Mathematica, like they did in the posted link. Also, any direction or thought on how I could eventually have the data coming into Mathematicain real time.

  • $\begingroup$ Does RTD and DDE do the same thing in Excel? If yes, please take a look at this post. Maybe you could do something like Dynamic[Refresh[ExcelRead["A2"], UpdateInterval -> 0]]. $\endgroup$ – Rod Jul 2 '13 at 20:53
  • $\begingroup$ I had looked at this post previously, but from the information I gathered, those commands require an ExcelLink package which costs ~ $250. Correct me if I'm wrong, because that would be a way to go about it. $\endgroup$ – user8264 Jul 9 '13 at 17:07
  • $\begingroup$ Also, RTD links and DDE links are a bit different. I don't know the technical details, but from what I remember, RTD links are a something which Microsoft more recently developed and are a bit more stable..The way in which information flows through those links is also different. $\endgroup$ – user8264 Jul 9 '13 at 17:09
  • $\begingroup$ It's not NetBlock, is NETBlock $\endgroup$ – Murta Feb 26 '15 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.