Classes

RTD

class RTD

RTD is a base class that should be derived from for use by functions wishing to return real time ticking data instead of a static value.

See Real Time Data for more information.

value

Current value. Setting the value notifies Excel that the value has been updated and the new value will be shown when Excel refreshes.

connect(self)

Called when Excel connects to this RTD instance, which occurs shortly after an Excel function has returned an RTD object.

May be overridden in the sub-class.

disconnect(self)

Called when Excel no longer needs the RTD instance. This is usually because there are no longer any cells that need it or because Excel is shutting down.

May be overridden in the sub-class.

XLCell

class XLCell

XLCell represents the data and metadata for a cell in Excel passed as an xl_cell argument to a function registered with xl_func.

Some of the properties of XLCell instances can only be accessed if the calling function has been registered as a macro sheet equivalent function [1].

value

value of the cell argument, passed in the same way as the var type.

Must be called from a macro sheet equivalent function [1]

address

string representing the address of the cell, or None if a value was passed to the function and not a cell reference.

Must be called from a macro sheet equivalent function [1]

formula

formula of the cell as a string, or None if a value was passed to the function and not a cell reference or if the cell has no formula.

Must be called from a macro sheet equivalent function [1]

note

note on the cell as a string, or None if a value was passed to the function and not a cell reference or if the cell has no note.

Must be called from a macro sheet equivalent function [1]

sheet_name

name of the sheet this cell belongs to.

sheet_id

integer id of the sheet this cell belongs to.

rect

XLRect instance with the coordinates of the cell.

is_calculated

True or False indicating whether the cell has been calculated or not. In almost all cases this will always be True as Excel will automatically have recalculated the cell before passing it to the function.

Example usage:

from pyxll import xl_func

@xl_func("xl_cell cell: string", macro=True)
def xl_cell_test(cell):
    return "[value=%s, address=%s, formula=%s, note=%s]" % (
                cell.value,
                cell.address,
                cell.formula,
                cell.note)

XLRect

class XLRect

XLRect instances are accessed via XLCell.rect to get the coordinates of the cell.

first_row

First row of the range as an integer.

last_row

Last row of the range as an integer.

first_col

First column of the range as an integer.

last_col

Last column of the range as an integer.

Footnotes

[1](1, 2, 3, 4, 5) A macro sheet equivalent function is a function exposed using xl_func with macro=True.