Is there a way to open a file and transfer it directly into a table on a timed script every 1 minute or so.
I have a constantly updating .csv file and need to import the values so I can use them as temperature readings in my project. I am using the following script to access the file which works but I need an automatic system that is constantly updating.
# Import Python's built-in csv library. import csv # Ask the user to find the CSV in the local file system. path = system.file.openFile("csv","C:\Users\Owner\Google Drive\Dobsons\Programming\Backup.Recorder Data Mar 2017.csv") #Create a reader object that will iterate over the lines of a CSV. # We're using Python's built-in open() function to open the file. csvData = csv.reader(open(path)) # Create a List of strings to use as a header for the dataset. Note that the number # of headers must match the number of columns in the CSV, otherwise an error will occur. # The simplest approach would be to use next() to read the first line in the file, and # store that at the header. header = csvData.next() # Create a dataset with the header and the rest of our CSV. dataset = system.dataset.toDataSet(header ,list(csvData)) # Store it into the table. event.source.parent.getComponent('Power Table').data = dataset