Jump to content
We've recently updated our Privacy Statement, available here. ×

How to export Spotfire crosstable (visualization) to Excel as xlsx file (NOT XLS)

Hung Huynh

Recommended Posts

I am trying to export Spotfire crosstable to excel as a xlsx file. I know how to perform this process with csv files. However, I get this error "file format or file extension is not valid" everytime I export the crosstable into excel. Background info: I have a visualization called "CrossTable".

Any help would be appreciated, thank you!

import System

import clr

from System.IO import FileStream, FileMode, File, StreamWriter

from Spotfire.Dxp.Application.Visuals import TablePlot,VisualContent,TablePlotColumnSortMode

from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers


from System.Windows.Forms import SaveFileDialog



SaveFile = SaveFileDialog()

SaveFile.FileName = "Crosstable.xlsx"

SaveFile.Filter = "Excel Workbook (*.xlsx)|*.xlsx"


saveFilename = SaveFile.FileName


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

stream = StreamWriter(saveFilename)

te = CrossTable.As[VisualContent]()



Link to comment
Share on other sites

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...