When a python function is exposed to Excel with the xl_func
decorator the docstring of that function is visible in Excel’s function
wizard dialog.
Parameter documentation may also be provided help the user know how to call the function. The most convenient way to add parameter documentation is to add it to the docstring as shown in the following example:
from pyxll import xl_func
@xl_func
def py_round(x, n):
"""
Return a number to a given precision in decimal digits.
:param x: floating point number to round
:param n: number of decimal digits
"""
return round(x, n)
PyXLL automatically detects parameter documentation written in the commonly used Sphinx style shown above. They will appear in the function wizard as help strings for the parameters when selected. The first line will be used as the function description.
Parameter documentation may also be added by passing a dictionary of parameter names to help strings
to xl_func
as the keyword argument arg_descriptions if it is not desirable to add it to the docstring
for any reason.
As you can see, the arguments and documentation you provide are fully integrated with Excel’s function wizard: