SpreadsheetExternal Class

class NXOpen.SpreadsheetExternal

Bases: NXOpen.TransientObject

Represents a class for external spreadsheet.

To call functions from this class, use SpreadsheetExternal object returned by NXOpen.SpreadsheetManager.OpenFile(). .. Usable only on Windows

New in version NX11.0.0.

Methods

Method Description
AppendRow Appends a new row of data to the Excel file.
CloseFile Closes an excel file with an option to save the file before close.
Dispose Free resources associated with the instance.
GetWorksheetIndex Returns worksheet ID.
ReadNamedRange Reads a named range.
ReadRange Reads the spreadsheet file and returns the data in the specified ranges of the cells.
WriteRange Writes the data to the specified range of the spreadsheet.

Method Detail

AppendRow

SpreadsheetExternal.AppendRow

Appends a new row of data to the Excel file.

Signature AppendRow(worksheet, data)

Parameters:

New in version NX11.0.0.

License requirements: None.

CloseFile

SpreadsheetExternal.CloseFile

Closes an excel file with an option to save the file before close.

Signature CloseFile(save)

Parameters:save (bool) – If true, the file will be saved. If false, the file will not be saved.

New in version NX11.0.0.

License requirements: None.

Dispose

SpreadsheetExternal.Dispose

Free resources associated with the instance.

After this method is called, it is illegal to use the object. In .NET, this method is automatically called when the object is deleted by the garbage collector.

Signature Dispose()

New in version NX11.0.0.

License requirements: None.

GetWorksheetIndex

SpreadsheetExternal.GetWorksheetIndex

Returns worksheet ID.

Signature GetWorksheetIndex(sheetname)

Parameters:sheetname (str) – Sheet name to get Index
Returns:worksheet ID
Return type:int

New in version NX11.0.0.

License requirements: None.

ReadNamedRange

SpreadsheetExternal.ReadNamedRange

Reads a named range.

Signature ReadNamedRange(worksheet, rangename)

Parameters:
  • worksheet (int) – worksheet ID
  • rangename (str) – Range name
Returns:

Data list for given range name

Return type:

list of NXOpen.SpreadsheetCellData

New in version NX11.0.0.

License requirements: None.

ReadRange

SpreadsheetExternal.ReadRange

Reads the spreadsheet file and returns the data in the specified ranges of the cells.

Signature ReadRange(worksheet, rowstart, colstart, rowend, colend)

Parameters:
  • worksheet (int) – Worksheet ID
  • rowstart (int) – Starting row of the range
  • colstart (int) – Starting column of the range
  • rowend (int) – Ending row of the range
  • colend (int) – Ending column of the range
Returns:

Data list for given range

Return type:

list of NXOpen.SpreadsheetCellData

New in version NX11.0.0.

License requirements: None.

WriteRange

SpreadsheetExternal.WriteRange

Writes the data to the specified range of the spreadsheet.

Signature WriteRange(data)

Parameters:data (list of NXOpen.SpreadsheetCellData) – The data list to be written to external Excel worksheet.

New in version NX11.0.0.

License requirements: None.