# Trying to export a CSV file from Power Chart, but the Excel data only have timestamp points, not the data from tag

**URL:** <https://forum.inductiveautomation.com/t/trying-to-export-a-csv-file-from-power-chart-but-the-excel-data-only-have-timestamp-points-not-the-data-from-tag/80275>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 10, 2023, 1:44pm UTC](https://forum.inductiveautomation.com/t/trying-to-export-a-csv-file-from-power-chart-but-the-excel-data-only-have-timestamp-points-not-the-data-from-tag/80275 "2023-10-10T13:44:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wenhe\_Zhao](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@Wenhe\_Zhao](https://forum.inductiveautomation.com/u/Wenhe_Zhao)\
**Post date:** [October 10, 2023, 1:44pm UTC](https://forum.inductiveautomation.com/t/trying-to-export-a-csv-file-from-power-chart-but-the-excel-data-only-have-timestamp-points-not-the-data-from-tag/80275/1 "2023-10-10T13:44:31Z")

</div>

Code is here,

```auto
def runAction(self, event):
		import json
		
		tagPaths = []
		aggregateModes = []
		histPaths = []
		self.view.custom.Saving = True
		array = self.view.params.Pens
		
		
		
		for row in array:
			rowObj = row['data']
			if rowObj['aggregateMode'] == "default":
				aggregateModes.append(self.view.params.DefaultAggregationMode)
			else:
				aggregateModes.append(rowObj['aggregateMode'])
			histPaths.append(rowObj['source'])
		for histPath in histPaths:
			tagPaths.append("[default]" + str(histPath).split("tag:")[1])
		points = self.view.custom.Points
		endTime = self.view.params.EndDate
		startTime = self.view.params.StartDate
		
		data = system.tag.queryTagHistory(paths=tagPaths,startDate=startTime, endDate=endTime, returnSize=points, returnFormat='Wide', aggregationModes = aggregateModes)
		
		csv = system.dataset.toCSV(data)
				
		filePath = system.perspective.download("chopper_use_time.csv", csv, "Comma Separated Values")
		
		self.view.custom.Saving = False

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5c6069199fdae0a2a72ba5baa19f268c3b4d7d5e.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/8/18fe094aa9e5f332d7c1c51104d05a86d060c9d2.png)

It should have 2 columns of data showing when is the machine running. I wanted to have the time when tag value is 0 (false), and the time when tag value is 1 (true), but only time\_stamp is showing, and it's just time, not the time when there is a feedback from tag.

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

---

<div class="post-metadata">

**Author:** ![Tim\_Carlton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim_carlton/32/52835_2.png) [@Tim\_Carlton](https://forum.inductiveautomation.com/u/Tim_Carlton)\
**Post date:** [October 10, 2023, 3:57pm UTC](https://forum.inductiveautomation.com/t/trying-to-export-a-csv-file-from-power-chart-but-the-excel-data-only-have-timestamp-points-not-the-data-from-tag/80275/2 "2023-10-10T15:57:06Z")

</div>

Can you show the actual csv? Open in notepad or similar and then paste the top few rows.

Excel does things that you may not expect to imported text files and the data that is shows may not match the actual data.

---

<div class="post-metadata">

**Author:** ![Wenhe\_Zhao](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@Wenhe\_Zhao](https://forum.inductiveautomation.com/u/Wenhe_Zhao)\
**Post date:** [October 10, 2023, 4:00pm UTC](https://forum.inductiveautomation.com/t/trying-to-export-a-csv-file-from-power-chart-but-the-excel-data-only-have-timestamp-points-not-the-data-from-tag/80275/3 "2023-10-10T16:00:50Z")

</div>

Below is the csv file opened in notpad, it shows the time with increment by one hour, but no display of feedback from the tag. 1 or 0 true or false etc. Thanks!

```auto
"t_stamp","RubberScale/Chopper_In_Use"
"2023-09-26 01:36:00.000",
"2023-09-26 02:35:58.125",
"2023-09-26 03:35:56.250",
"2023-09-26 04:35:54.375",
"2023-09-26 05:35:52.500",
"2023-09-26 06:35:50.625",
"2023-09-26 07:35:48.750",
"2023-09-26 08:35:46.875",
"2023-09-26 09:35:45.000",
"2023-09-26 10:35:43.125",
"2023-09-26 11:35:41.250",
"2023-09-26 12:35:39.375",
"2023-09-26 13:35:37.500",
"2023-09-26 14:35:35.625",
"2023-09-26 15:35:33.750",
"2023-09-26 16:35:31.875",
"2023-09-26 17:35:30.000",
"2023-09-26 18:35:28.125",
"2023-09-26 19:35:26.250",
"2023-09-26 20:35:24.375",
"2023-09-26 21:35:22.500",
"2023-09-26 22:35:20.625",
"2023-09-26 23:35:18.750",
"2023-09-27 00:35:16.875",
"2023-09-27 01:35:15.000",
"2023-09-27 02:35:13.125",
"2023-09-27 03:35:11.250",
"2023-09-27 04:35:09.375",
"2023-09-27 05:35:07.500",
"2023-09-27 06:35:05.625",
"2023-09-27 07:35:03.750",
"2023-09-27 08:35:01.875",

```

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 10, 2023, 7:15pm UTC](https://forum.inductiveautomation.com/t/trying-to-export-a-csv-file-from-power-chart-but-the-excel-data-only-have-timestamp-points-not-the-data-from-tag/80275/4 "2023-10-10T19:15:23Z")

</div>

You should take the code into the script console, manually build your queryTagHistory call and see what is coming back.

It looks to me like the history query is not returning data.  
My bet will be the line where you are building your tag paths is resulting in non valid tag paths for history.
