How to export data to existing Excel workbook?

Hello all,
If possible, I would like to export data from a named query to an existing Excel workbook.
If not possible, I would like to export the same data to a new Excel workbook.

I have been playing with the system.dataset.toExcel function, but have not been able to get it to write a file to the specified directory.

This code system.file.writeFile(filePath, spreadSheet) is called from a button event, and presumably it runs the code, because I have a test line afterwards that fires.

I did ask about an error I had earlier while attempting to do this, which I had tagged my question onto this thread: https://forum.inductiveautomation.com/t/perspective-table-excel-report/70598/4

Any ideas why Ignition will not write/create this file? I also created the file manually, thinking maybe it had to be there already, but no, no data was added to the file.

I even changed queries, just in case...

You're doing this on perspective? Then the save file function is trying to create a file on the gateway, does your Ignition gateway have write access for the folder you are trying to save the file to?

Perspective, yes. Well, I did not realize it was trying to save it on the gateway, but one way or another I would like to get that file to the user's computer. So, are there any functions that save to the user's local hard drive?

Or, how would I get files saved to the gateway to my computer without having to have some sort of admin access?

system.perspective.download()

Lots of examples on this forum.

2 Likes