Exporting live tag values to Excel

scripting
ignition79
python
database
#1

Is there a way to export live tag values to excel and store them to view the RAW data? Basically I have a sensor which is reading data and calculating averages in the PLCs, I would like to analyse all the data coming through the PLC tag for experimental and analytic purposes. I have tried using easy chart to save the data but was not sure how to start and stop easy chart using a particular tag but not by time.
Any help would be appreciated, Thank You in advance.

0 Likes

#2

Are you keeping a history of the tag? By logging to a database. If not you’ll have to set that up first. I would recommend transaction groups.

https://docs.inductiveautomation.com/display/DOC80/Transaction+Group+Examples
https://docs.inductiveautomation.com/display/DOC80/system.dataset.toCSV

something resembling the code below could be ran on a timer or off an event trigger.

results = system.db.runQuery("SELECT * FROM example1 LIMIT 100")
results = system.dataset.toDataSet(results)
csv = system.dataset.toCSV(dataset = results, showHeaders = True, forExport = False)
filePath = "C:\\output\\results.csv"
system.file.writeFile(filePath, csv)

0 Likes