How to export to CSV


Hi there. Simple question: Is there a way to export to CSV or JSON (or just simple text) the data from a Raw Data Table natively? If not is there a way to get the data stored in it so I can build/export it myself?


Hi there @william. Actually is possible to export data as CSV from the RDT. Right now is only available through the AQL, but we are planning to include it in the UI in the future.

To export to CSV from a Raw Data Table is very easy:

const rdt = cf.getVisualization('rdt-element');


Note the extra () at the end, is because get('csv') returns a function. This will automatically download the csv file to your default download folder or it will ask you were to store it depending on your browser.

I hope it helps


Thanks! One last question: Is there an easier way to get the element if I’m in ChartFactor Studio? For now I manually inspect the element and grab it from the div id.


There is a global function in Studio you can use for that: getId("widget name"), where widget name is the title of the widget containing the visualization. You can use it from the developer tools or even from any other widget.


Thanks @gen_dev! Of course. I was editing the Interaction Manager and I saw the getId function being used. I completely missed that.


This is really helpful. I was about to ask the question but I saw the thread.

I have an additional question: Is it possible to do the same from any other visualization? I mean to obtain the data?. The thing is that in more that one occasion we have needed the data from a Bars or a Pie visualization for example.

We’ve sort of worked around it by using Slicers. But we’ve sort of wanted to obtain the data to export it as json or csv as well.


Hi @sandip. You can obtain the data from any visualization in JSON format like this:

const visual = cf.getVisualization('div-id')


The format of the JSON object obtained is described here in the documentation.


Just in case, @sandip, I forgot to mention that is not required to use a visualization to get the data. ChartFactor can obtain data without visualizing:

.then(response => console.log(