-1

I'm currently working on a program that runs in visual basic (not VBA). The program collects data from sensors and produces a data file (*.csv) of the information it collected after a certain stretch of time. I'm hoping to add onto or even change the program so that I can perform real time calculations with the data collected.

Is it possible to live stream data being stored to a *.csv file to an excel spreadsheet and if so how would one do it in VB? I'm writing a macro to constantly run in the background of the spreadsheet to perform the necessary calculations as new data is being imported.

P.S. I did not write the original program and am still extremely new to coding so I'm still trying to make sense of everything myself

3
  • 1
    You may find issues about streaming to the file and accessing the file at the same time!! Is this VB6 or VB.net?
    – Dave
    Jun 30, 2015 at 14:56
  • OLE/Automation is a method used for inter-application communication. Excel can be set up to get the data from the application itself rather than via an intermediary text file, but you will need to set up the original program to support it also.
    – Yorik
    Jun 30, 2015 at 15:18
  • start learning databases. Sqlite3 for example.
    – befzz
    Jun 30, 2015 at 21:02

1 Answer 1

1

Unfortunately, Excel is a poor choice here as it assumes you want the whole csv file and locks it. When it does that, you can no longer write to it.

You could use something like the Microsoft PowerQuery addin to read the data but this wouldn't be realtime and would have to reload the whole thing on each refresh (which can be automated).

Alternatively, if you don't actually need Excel, you could do this fairly readily with a simple, local, web app using a Microsoft HTA (HTML Application) or Node-Webkit (the latter being preferred since it gives you the full power and capability of Node.JS which is perfectly happy dealing with streaming files. Of course, these solutions would require programming skills. :( though one's that would stand you in good stead elsewhere. :)

Not the answer you're looking for? Browse other questions tagged .