Hi @Footsore
Thank you for providing all the details of the use case These details are incredibly useful for helping us to help you. Very impressive work as well Dave!
If you have these SQL queries and JS scripts built out already in an app, you should be able to reference them from the query drop down menu that I shared in the screen shot of my last post.
This will definitely save you time. You can also build this code into workflow code blocks/query blocks manually but this would of course take more time. I am sure most of it could be copy/pasted but I would recommend typing out the query name into the search bar at the top of a query block.
On your final point about exporting to csv, I just did some testing and found another form thread about how to automatically email out the CSV file containing the data using an SMTP workflow block. Check out this thread and the solution comment!
I do not believe it is currently possible to have a workflow download a CVS directly to your local machine/computer, but I will look into this. The next best option is to automate sending an email with the newly created CSV file attached.
The JS library you would use to parse the CSV from the data you have is already included in the workflow.
You just need to call const csv = Papa.unparse(data);
then pass csv
to the SMTP email block and provide that with the correct format in the 'Attachments' area, something like this [{ data: '{{btoa(code.data)}}', name: 'fileName.csv', contentType: 'csv' }]
Let me know if this works for you, I also love this use case and think our team would like to get in touch with you and your team to potentially do a case study on your set up for other similar utility companies to learn from!