Exporting in CSV
-
Hey, I searched and I think I know the answer (no) but I thought I would ask. I've been asked to generate a custom CSV once a day based on point data. Basically just export some point name, value and timestamp. Is that possible right now? I just want it stored on the local drive because then I'll FTP it out.
-
Far be it from me to say it can't be done!
One straightforward way for complete control is to just write out to a file from a scripting environment:
var fileOutputStream = null; try { fileOutputStream = new java.io.FileOutputStream( new java.io.File("/path/to/output/file.csv"), false ); var writer = new java.io.PrintWriter(fileOutputStream); for(var k = 0; k < valuesList.length; k+=1) { writer.println("Your constructed CSV line here."); } } finally { if(fileOutputStream != null) fileOutputStream.close(); }
It may also be possible to use an excel report and trigger a process event handler to run some other program that converts Excel to CSV (such a thing must exist...). Stack exchange suggests open office may have you covered: https://unix.stackexchange.com/questions/23726/convert-a-xlsx-ms-excel-file-to-csv-on-command-line-with-semicolon-separated
-
Another option would be to use cron and curl to grab the a CSV file from the REST API (use an auth token). This wont allow you to do a custom format but I think we already pretty much have the format you are asking for. Try downloading the CSV file using the download button on a watch list and let me know if its suitable.
-
You guys are awesome :)
Thank you