# Exporting dataset to CSV results in extra rows with #NAMES & #TYPES

**URL:** <https://forum.inductiveautomation.com/t/exporting-dataset-to-csv-results-in-extra-rows-with-names-types/86300>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 23, 2024, 10:57pm UTC](https://forum.inductiveautomation.com/t/exporting-dataset-to-csv-results-in-extra-rows-with-names-types/86300 "2024-02-23T22:57:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawn\_Rieger1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger1/32/57040_2.png) [@Shawn\_Rieger1](https://forum.inductiveautomation.com/u/Shawn_Rieger1)\
**Post date:** [February 23, 2024, 10:57pm UTC](https://forum.inductiveautomation.com/t/exporting-dataset-to-csv-results-in-extra-rows-with-names-types/86300/1 "2024-02-23T22:57:48Z")

</div>

I have a button script that uses `system.tag.queryTagHistory` and assigns the results to a custom property on root. My export script looks like this:

```auto
data = self.view.getChild("root").custom.data
csv = system.dataset.toCSV(data, True, True)
system.perspective.download('data_export.csv', csv)

```

The resulting export has additional rows as seen below.

```auto
"#NAMES"
"t_stamp","POI/SEL735/Voltage A"
"#TYPES"
"java.sql.Timestamp","D"
"#ROWS","1057"
"2024-02-23 13:00:00.972","20.496688842773438"
"2024-02-23 13:00:02.983","20.49338150024414"

```

the binding can be seen here:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/8/087c6a015a95a049bbe2d6175d4a528e19e54e36.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 23, 2024, 11:00pm UTC](https://forum.inductiveautomation.com/t/exporting-dataset-to-csv-results-in-extra-rows-with-names-types/86300/2 "2024-02-23T23:00:06Z")

</div>

That's what the `forExport` parameter you set to `True` does.

> **[system.dataset.toCSV | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-dataset/system-dataset-toCSV#keywords)**
>
> Formats the contents of a dataset as CSV (comma separated values), returning the resulting CSV as a string.

---

<div class="post-metadata">

**Author:** ![Shawn\_Rieger1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger1/32/57040_2.png) [@Shawn\_Rieger1](https://forum.inductiveautomation.com/u/Shawn_Rieger1)\
**Post date:** [March 5, 2024, 3:35pm UTC](https://forum.inductiveautomation.com/t/exporting-dataset-to-csv-results-in-extra-rows-with-names-types/86300/3 "2024-03-05T15:35:03Z")

</div>

Thanks Kevin! That did it!
