Export data into a Google Drive folder

Has anyone successfully written code to export data to a file on Google Drive through Ignition? I would want to have a gateway script that checks for the data, creates a dataset, and then puts it into a spreadsheet on Google Drive. CSV would also be acceptable. I know how to create the dataset, just no idea how to get it into a spreadsheet on Google Drive.

I’ve done this in the past by setting up Google Drive Backup and Sync on the Ignition gateway. This allows you to save to the synced GDrive folder the same way you would save to any other location on your Gateway’s filesystem. (Take a look at the system.file.saveFile() and system.file.writeFile() functions, just keep in mind that these will need to run on your Gateway to have access to the synced GDrive folder)

To convert your dataset to a CSV you can use system.dataset.exportCSV().

Note: With the GDrive Backup & Sync, you will need to have a user that can be signed in at all times on the Gateway. Anyone with access to the Gateway will be able to access the contents of that synced GDrive folder. I created a stand alone Google user for this purpose.

Hmm, good point. It would be cleaner to use scripting to send it directly to the Google Drive service/API, but your way is probably a lot easier to set up within the Ignition environment.