# Dataset to CSV without quotes

**URL:** <https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [October 27, 2021, 6:33am UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381 "2021-10-27T06:33:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [October 27, 2021, 6:33am UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381/1 "2021-10-27T06:33:59Z")

</div>

Hi all 🙂

We are running a query against a table in our database, and it returns a dataset with two columns ( name , value ).  
The dataset is converted to a CSV by:

`csv = system.dataset.toCSV(ds,1)
`

We then save the CSV file to our local disk.

If we open the CSV in notepad, there are quotation marks around all names and values:

“#NAMES”  
“Tag”,“hour”  
“#TYPES”  
“str”,“D”  
“#ROWS”,“196”  
“test1”,“0.7791961111111098”  
“test2”,“0.7791961111111098”  
“test3”,“0.7791961111111098”  
.  
.  
.

Anyone knows how to export a dataset to a CSV file without all the quotations?

Ignition version 7.9.10

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [October 27, 2021, 7:41am UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381/2 "2021-10-27T07:41:08Z")

</div>

Seems like this small snippet of code did it:

```auto
csv = system.dataset.toCSV(ds,1)
filename = "test.csv"
system.file.writeFile(filename,csv)

with open('test.csv','rt') as f:
	data = f.read()
new_data = data.replace('"','')

filePath = "newCSV.csv"
system.file.writeFile(filePath, new_data)
```

🤠

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 27, 2021, 1:01pm UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381/3 "2021-10-27T13:01:46Z")

</div>

Why do you want to remove quotes? Wont this will break many strings?..

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [October 27, 2021, 1:23pm UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381/4 "2021-10-27T13:23:41Z")

</div>

A third party company that is using the csv-file asked us if we could get rid of the quotations, since their system were not able to interpret the original csv with quotations.  
So we adjusted the script to save both the original csv with quotations, and a new csv without the quotations. Now they can use either of them in their attempt to gather the csv-data 🙃

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 27, 2021, 1:30pm UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381/5 "2021-10-27T13:30:37Z")

</div>

> [@andreas](#):
>
> since their system were not able to interpret the original csv with quotations

yikes xd welh if you save both then it is their problem i guess lol

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [October 27, 2021, 1:35pm UTC](https://forum.inductiveautomation.com/t/dataset-to-csv-without-quotes/52381/6 "2021-10-27T13:35:32Z")

</div>

yikes indeed 😆  
Wishing them the best of luck… 😄
