When returning values or arrays from a worksheet function, or when setting values on a sheet using a macro function, often you will also want to set the formatting of the values in Excel. This can be to make sure a returned value has the correct date or number format, or styling a whole table.
Standard formatters are provided for common cases, and you can also write your own formatters to achieve the exact style you need.
Warning
Formatting cells in Excel uses an Excel macro. Macros in Excel do not preseve the “UnDo” list, and so after any formatting has been applied you will not be able to undo your recent actions.
Warning
Formatting is new in PyXLL 4.5.
For prior versions formatting can be applied using the Excel Object Model.
Calls to Excel cannot be made from an xl_func
function, but can be scheduled using
schedule_call
.
Note
Formatters applied to Dynamic Array functions make use of Workbook Metadata to keep track of formatting applied in order to clear it if the array later contracts.