Hung Huynh Posted July 31, 2019 Share Posted July 31, 2019 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 clr.AddReference("System.Windows.Forms") from System.Windows.Forms import SaveFileDialog SaveFile = SaveFileDialog() SaveFile.FileName = "Crosstable.xlsx" SaveFile.Filter = "Excel Workbook (*.xlsx)|*.xlsx" SaveFile.ShowDialog() saveFilename = SaveFile.FileName writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsxDataWriter) stream = StreamWriter(saveFilename) te = CrossTable.As[VisualContent]() te.ExportText(stream) stream.Dispose() Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now