# CSV export from PowerChart in Perspective : Changing the separator

**URL:** <https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [December 4, 2023, 7:53pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682 "2023-12-04T19:53:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Paradis](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@Thomas\_Paradis](https://forum.inductiveautomation.com/u/Thomas_Paradis)\
**Post date:** [December 4, 2023, 7:53pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/1 "2023-12-04T19:53:53Z")

</div>

Hi,

I've been having trouble with figuring out how to change the separator used for the PowerChart export to CSV.

The users of our gateway can have either comma or semi-column as a separator in their windows region setting. Most of these people also strictly use the PowerChart tool for their need. They then often convert these to csv to (try to) incorporate in their Excel charts. The conversion step required (adding "sep=,") at the beginning can be a bit overwhelming for some of them.

I figured: No problem I'll setup a script with 2 buttons. I can easily get my datasets from a regular chart or graph and add the required code with:

chart = self.getSibling("chart")

data = chart.props.data

csv = system.dataset.toCSV(data)

formating = "sep , \n"

formatedcsv = formating + csv

system.file.writeFile(...)

But I can't find the way to get the data from a PowerChart in the same way. There might also be a way to change the option directly from the properties of the chart, but I wasn't yet able to find it.

Any tip or ideas to help me figure this one out? Thank you in advance.

---

<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:** [December 4, 2023, 8:34pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/2 "2023-12-04T20:34:27Z")

</div>

Perhaps you should be using ~~[system.dataset.exportExcel()](https://docs.inductiveautomation.com/display/DOC81/system.dataset.exportExcel)?~~ Avoid the locale problem entirely?

Edit: See note below.

---

<div class="post-metadata">

**Author:** ![Thomas\_Paradis](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@Thomas\_Paradis](https://forum.inductiveautomation.com/u/Thomas_Paradis)\
**Post date:** [December 4, 2023, 8:58pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/3 "2023-12-04T20:58:17Z")

</div>

Sadly I still need the dataset from the PowerChart to do this.  
I might be able to reach it in Props/Pens/X/Data but that would still give me only one column. Is my only solution a "for" to check all of them for data and rebuild the dataset column by column at that point?

---

<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:** [December 4, 2023, 9:00pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/4 "2023-12-04T21:00:26Z")

</div>

Yes, you will need to iterate to construct the dataset, or perhaps construct a series of datasets. (You can pass multiple datasets to ~~`.exportExcel()`~~ `.toExcel()`.)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 5, 2023, 12:56pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/5 "2023-12-05T12:56:37Z")

</div>

> [@pturmel](#):
>
> you should be using [system.dataset.exportExcel()](https://docs.inductiveautomation.com/display/DOC81/system.dataset.exportExcel)

Except this is for Perspective, and `.exportExcel()` is Vision Client scope only.

---

<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:** [December 5, 2023, 1:36pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/6 "2023-12-05T13:36:21Z")

</div>

Whoops! I mixed that up with [system.dataset.toExcel](https://docs.inductiveautomation.com/display/DOC81/system.dataset.toExcel). Use `.toExcel()`. Combined with `system.perspective.download()`.

---

<div class="post-metadata">

**Author:** ![Thomas\_Paradis](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@Thomas\_Paradis](https://forum.inductiveautomation.com/u/Thomas_Paradis)\
**Post date:** [December 6, 2023, 3:57pm UTC](https://forum.inductiveautomation.com/t/csv-export-from-powerchart-in-perspective-changing-the-separator/82682/7 "2023-12-06T15:57:14Z")

</div>

Thanks for the replies. I'll figure something that works with the .toExcel() and then post the working script when done.
