Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Current »

This function is used in Python Scripting.

Description

Exports the contents of a dataset as an Excel spreadsheet, prompting the user to save the file to disk. Uses the same format as the dataSetToExcel function.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.exportExcel(filename, showHeaders, dataset[, nullsEmpty])

  • Parameters

String filename - A suggested filename to save as.

boolean showHeaders - If true (1), the spreadsheet will include a header row.

Object[] dataset - A sequence of datasets, one for each sheet in the resulting workbook.

This feature is new in Ignition version 7.9.8
Click here to check out the other new features

Boolean
 nullsEmpty If True (1), the spreadsheet will leave cells with NULL values empty, instead of allowing Excel to provide a default value like 0. Defaults to False. [Optional]

  • Returns

String - The path to the saved file, or None if the action was canceled by the user.

  • Scope

Client

Code Examples
Code Snippet
# This snippet would prompt the user to save the data currently displayed in a Table component to an Excel-compatible spreadsheet file, and would open the file after a successful save.
 
table = event.source.parent.getComponent("Table")
filePath = system.dataset.exportExcel("data.xls", 1, table.data)
if filePath != None:
   system.net.openURL("file://"+filePath)
  • No labels