Jump to content

Export Visualization Table To .csv


Herschel Gapen

Recommended Posts

Hey I am fairly new to IronPython. I would like to know if there is a way to write a script for an action controlthat 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

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...