Exporting data from a Easy Chart

When exporting data from a Easy Chart, when I open the excel file it puts the data in different sheets. The labels for the sheets says Dataset 1, Dataset 2 , Dataset 3, etc. Is there a way to give it a different name so someone can know what equipment the Dataset belongs to

Not directly from the chart, but you can ask the chart to exportDatasets and pair that return value with system.dataset.toExcel:

Then use system.file.saveFile to prompt the user for where to save the file.

And then system.file.writeFile to actually save it to disk:

Do you mean individual excel documents, because i think system.dataset.toExcel is just going to name your sheets Dataset 1, Dataset 2 etc.

It needs to be the same document.

I should have replied to @PGriffith. I did a little testing and it doesn’t look like you have any control over the sheet names.

Is there a way to get around it using a script on a button?

I tried that but still got the same thing. Alternatively you could do something like include the machine name in the tag path.

I even tried grouping the data into equipment but you get the same results

Consider using Apache POI libraries’ API for Microsoft file formats. Start here:

Examine the javadocs to work out writing instead of reading.

Total control.

(The java api is included in Ignition v8+. You can add a 3rd party module, like Kymera’s office documents module, to get access in v7.9.)

1 Like

There should be a trailing argument sheetNames for toExcel:

List sheetNames - Expects a list of strings, where each string is a name for one of the datasets. When used, there must be an equal number of string names in sheetName as there are datasets in the dataset parameter. Names provided in this parameter may be sanitized into acceptable Excel sheet names. [optional]

1 Like

How did i miss that?! As usual you are absolutely correct, thank you!