PDA

View Full Version : Importing live data into Excel from CSV File



zqia014
20-05-2010, 11:35 AM
Hi all,

Does anybody know how to do this? I have a recording system that generates .csv files and I need analyze them in Excel 2007. I can manually import them while it's recording and refresh it once in a while to get new datapoints.

But how would I get Excel to automatically update it? It takes a recording every second so I would like Excel to automatically update every second, without me having to click refresh.

Thanks for all suggestions.

MushHead
20-05-2010, 02:11 PM
I've just thrown this together - probably needs some way of stopping the run without opening up the VB editor...

In the "Sheet1" (insert your name here) worksheet's code area, put this:


Public Sub Recalculate()
ThisWorkbook.ActiveSheet.Calculate
End Sub

' This is called after a recalculation
Private Sub Worksheet_Calculate()
Application.OnTime Now() + TimeValue("00:00:05"), "Sheet1.Recalculate"
End Sub


In my example, the worksheet recalculates every 5 seconds.

Probably needs a bit more fleshing out, but hopefully is the way to do it...