52.8 The excelapi module

The excelapi module provides scripting access to Excel workbooks from Server script nodes. It is based on Apache POI and supports the XLSX format. To use the module, import it at the top of your script:

import excelapi
wb = excelapi.newWorkbook()
Example 52.10:  Importing the excelapi module in Jython
import excelapi
def wb = excelapi.newWorkbook()
Example 52.11:  Importing the excelapi module in Groovy

The workbook objects returned by this module are Apache POI Workbook instances. Refer to the Apache POI API documentation for details on how to work with sheets, rows, and cells.

 
 
Object newWorkbook()
Create a new, empty Excel workbook.
Returns A new Apache POI Workbook object representing an empty Excel workbook.
 
Object openWorkbook(InputStream stream)

Open an existing Excel workbook from an input stream. The caller is responsible for closing the stream.

Parameters
stream The input stream to read the workbook from.
Returns An Apache POI Workbook object representing the opened Excel workbook.
 
Object openWorkbook(String filename)

Open an existing Excel workbook from a file. The file is opened and closed automatically.

Parameters
filename The path to the Excel file to open.
Returns An Apache POI Workbook object representing the opened Excel workbook.