Export Visualization Table To .csv

Hey I am fairly new to IronPython. I would like to know if there is a way to write a script for an action control that allows me to export a table visualization to a .csv.

So far I have been able to export my data table via the script below

from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers

from System.IO import File

writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsDataWriter)

table = Document.ActiveDataTableReference #OR pass the DataTable as parameter

filtered = Document.ActiveFilteringSelectionReference.GetSelection(table).AsIndexSet() #OR pass the filter

stream = File.OpenWrite("FILEPATH/FILENAME.csv")

names = []

for col in table.Columns: 

    names.append(col.Name)

writer.Write(stream, table, filtered, names)

stream.Close()

 

How do I change this so I can export a table visualization and not my data table?

(1) Answer

Login