Search

User Manual

GETTING STARTED


MODULES AND PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


GLOSSARY


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support
SDK Documentation
SDK Examples

ALL MANUAL VERSIONS

Ignition 8.1
Ignition 7.9
Ignition 7.8

Deprecated Pages

Skip to end of metadata
Go to start of metadata

This feature is new in Ignition version 8.0.7
Click here to check out the other new features
This function is used in Python Scripting.

Description

Formats the contents of one or more datasets as an excel spreadsheet, returning the results as a string. Each dataset specified will be added as a worksheet in the Excel workbook.

This function replaces the deprecated system.dataset.dataSetToExcel function.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.dataset.toExcel(showHeaders, dataset, [nullsEmpty], [sheetNames])

  • Parameters

Boolean showHeaders - If True, the spreadsheet will include a header row. If False, the header row will be omitted. 

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

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

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

List sheetNames - Expects a list of strings, where each string is a name for one of the datasets. When used, there must be an equal number of string names in sheetName as there are datasets in the dataset parameter. Names provided in this parameter may be sanitized into acceptable Excel sheet names. [Optional]

  • Returns

Array - A byte array representing an Excel workbook.

  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
Code Snippet
# This snippet would run a SQL query against a database, and turn the results into a string that is XML that Excel can open. It then writes the string to a file on the local hard drive.
 
results = system.db.runNamedQuery("Fetch Records",{})
spreadsheet = system.dataset.toExcel(True, [results])
filePath = "C:\\output\\results.xls"
system.file.writeFile(filePath, spreadsheet)
Keywords

system dataset toExcel, dataset.toExcel

  • No labels