# exportExcel() files with t\_stamp and value fields from easyCharting

**URL:** <https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [September 5, 2023, 8:51am UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751 "2023-09-05T08:51:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [September 5, 2023, 8:51am UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751/1 "2023-09-05T08:51:03Z")

</div>

Good morning everyone,  
I have a little problem and I would like to know if there is a method that I am not using well. 😅

I want to export by means of a button, all the values that are selected in the easyCharting, at the moment it shows me the fields NAME and GROUP\_NAME of the pens (just what I need).

in addition to this I want to show me T\_STAMP and the VALUE that is currently taking in the table. can I do that?

este es el codigo que tengo actualmente, es un script onlick de on boton

this is the code that I have at the moment, it is a script onlick of on button

```auto
# Get the Dataset component named "DDBB"
data_ddbb = event.source.parent.getComponent('DDBB').pens

# get the column index of the enabled column to filter data
enabled_column_index = data_ddbb.getColumnIndex("ENABLED")

# Create a list that will become a list of lists for a dataset
data = []

# Get the column headers from the pens dataset
headers = ["NAME", "GROUP_NAME"] 
print headers
# iterate through each row of the pens dataset to see if the pen is enabled
for row in range(data_ddbb.rowCount):
	if data_ddbb.getValueAt(row, enabled_column_index):
		
		# Create a row list for the row data 
		rowData = []
		
		# iterate through each column to get the row data
		for column in range(data_ddbb.columnCount):
			rowData.append(data_ddbb.getValueAt(row, column))

		# append the row list to the main list
		data.append(rowData)
		
# Create a dataset with the selected pens data for exporting to Excel
selectedData = system.dataset.toDataSet(headers, data)

# Export the dataset
file_path = system.dataset.exportExcel("SelectedData", True, selectedData)

```

regards,

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 5, 2023, 12:02pm UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751/2 "2023-09-05T12:02:17Z")

</div>

No, the `pens` dataset is just configuration for what to show on the chart. It does not contain any of the displayed data. For the EasyChart, you will need to go "under the hood" with the implementation's [JFreeChart](http://www.jfree.org/jfreechart/api/javadoc/) objects to access the displayed data and pick out the points of interest.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [September 5, 2023, 1:30pm UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751/3 "2023-09-05T13:30:25Z")

</div>

I have already made a drastic change in the code, now I am looking for it through the exportDatasets

```auto
Dataset = event.source.parent.getComponent('DDBB')

Dataset_data = Dataset.exportDatasets()[1]
print Dataset_data
Dataset_Sheet_Names = ["data"]
path = system.dataset.exportExcel("SelectedData",True,Dataset_data)
SpreadSheet = system.dataset.toExcel(True,Dataset_data, True, Dataset_Sheet_Names)
system.file.writeFile(path, SpreadSheet)

```

this is the table with the data that I want to extract

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/b/dbb274de8488a41d2f77e54f7a49e8a198f404cf.png)

and this is the excel result:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/9/b95dfdea3f408cf970cbf793de0be9be0f194bee.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/b/2b760ed015c1b7ae6d4b649b2ec3c3c7fb8aff08.png)

now I want to add to excel the column GROUP\_NAME, to determine where each value comes from, because I am extracting the data without knowing which is which.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 5, 2023, 1:42pm UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751/4 "2023-09-05T13:42:59Z")

</div>

Ah, you are after the values associated with an X-Trace.

I'm pretty sure that this has been answered in detail at some point, but I don't keep up with that. I just use my `EasyNoteChart` (from my [NoteChart](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-notechart) 3rd-party module) component in place of any `EasyChart`. My NoteChart components _ **provide this exact functionality** _ as a standard component property `samples` aka "Pen Value Samples".

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [September 5, 2023, 1:47pm UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751/5 "2023-09-05T13:47:21Z")

</div>

mm sounds like a solution heheh, I don't think that at this stage of the project I can implement a new module, I'll try, but for now I'll just export it with the easychart button.

thanks again Phill.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 5, 2023, 8:50pm UTC](https://forum.inductiveautomation.com/t/exportexcel-files-with-t-stamp-and-value-fields-from-easycharting/78751/6 "2023-09-05T20:50:30Z")

</div>

> [@Miguel\_Cimildoro](#):
>
> I can implement a new module

You don't have to implement a module--mine is available for purchase in the 3rd party module showcase. (:
