How can I label the datasets I export to excel?
Can you be more specific? If you just want the headers in excel, there is the showHeaders boolean parameter for the dataSetToExcel API function.
https://docs.inductiveautomation.com/display/DOC79/system.dataset.dataSetToExcel
When you export a few datasets to excel, the tab names are generic ( Dataset1, Dataset2,… ).
This is currently confusing some of our users, especially when we export 9 or 10 datasets into one spreadsheet.
Can I label these tabs? If Ignition doesn’t have this functionality, could you suggest a python or java library that can handle this - keeping in mind that the changes need to be completed before the user saves the file to their computer.
How are you currently doing the export? Maybe a starting point would be helpful.
DataSetsList = [ LIST OF DATASETS ]
Alias = Job.getValueAt( 0, 'Alias' )
SuggestedFileName = Alias + ' Data' + '.xls'
FilePath = DestinationPath + '\\' + SuggestedFileName
ExcelFile = system.dataset.dataSetToExcel( True, DataSetsList )
system.file.writeFile( FilePath, ExcelFile )
This is pretty hokey, but the dataSetToExcel function technically just returns an XML string that makes up the document.
So you could do a string replace for:
#dataset1
ExcelFile.replace("ss:Name=\"Dataset 1\"", "ss:Name=\"SpectacularDataSet\"")
#dataset2
ExcelFile.replace("ss:Name=\"Dataset 2\"", "ss:Name=\"TerrificDataSet\"")
system.file.writeFile( FilePath, ExcelFile )