Export dataset to XLS filetype from Time Series Chart

Hi guys, have a good days.

Currently I have a configurable Time Series Chart which the user is able to choose the start date and end date. After the user generate the chart I would like export the dataset in xls format. May I know what is the best way to do it because I had tried in many ways but it dint work.

Image above show the time series chart and the dataset in Ignition Designer. May I know how can I read the dataset and export the xls file format or I should read the timeserieschart data then only export in xls format.

Thanks in advance.

This thread may be of use.

@JordanCClark Hi Bro, thanks for your link but this is not the one I want. What I want is export the data in the dataset to excel format by clicking a button in the perspective. So I think what I need to use is system.dataset.toExcel but I had tried this code but it dint work. May I know that is there any example.

Thanks in advance.

Trust me. That thread has both.

Ok Thanks a lot @JordanCClark. I’ll give a try.

Hi, @JordanCClark I had tried by following the thread you provided but I still facing some problems which I could not get the dataset from the Time Series Chart as the image shown below.

The thread that you provided is hard code the dataset inside the script. In my case, I would like to get the dataset from Time Series Chart like the image above. May I know how can I do that ?
Image below show the hard code of the data set in the script.


Link above is the exportDatasets() for the easy chart component. May I know did you try these before because I could not found this code in the Ignition documentation.

Thanks in advance.

Sorry, been on vacation…

You’re talking about two very different components with very different properties.

Try pointing ds in the script to the data property in your series.

Hi @JordanCClark, it is good to hear from you again.

Yaa, I had tried to point the dataset in the script but it cant work.

Do you have any example or you have any idea to write the script that to pointing the dataset to the data property in the series.

Thanks in advance.

Finally got some time to dig into this a bit further for you.
I updated the linked script to allow for JsonDataSets, and to allow the output to be a byte array.

I put the function into a project script (I used util), than called it from a button:

	dataIn = self.getSibling("TimeSeriesChart").props.series[0].data
	workbook = util.datasetToExcel(dataIn)		
	system.perspective.download('data.xlsx', workbook)

The script mentioned above has been implemented, now i can able to download multiple dataset in single excel file at different sheets.
Now i need to change the sheet names using script , can you please help on this
(Dataset1,Dataset2,Dataset3.......) to different names , refer to the screenshot.