Skip to content

Tag: xlwings

XLWINGS conditional formatting based on value

I have a dataframe in Pandas that I have exported to Excel and formatted headers etc. using XLWINGS. That works like a charm. But I would like to format two columns based on their value in each cell (row), so if the value is above 0 then green and below zero then red. I can’t seem to find that option

How to scroll down to last row with data?

I have an Excel file with many rows and it gets many entries daily. That’s why I would like to scroll down the file to last row with data. To find the last row, I use: How could I scroll down to it using Python (and preferably XLWings module)? Answer Use used_range, it’s more robust than expand(&#…

Print Excel to pdf with xlwings

I am trying to print Excel files to pdf with xlwings. I am using the excel api for this. I have tried it in two ways: 1/ Using the PrintOut() call with PrintToFile argument: The problem here is Excel just prints the file, ignoring my additional settings. 2/ Using ExportAsFixedFormat Here Excel flashes a bit, …

xlwings RunPython with function arguments

I am trying to run the RunPython function from a button in excel. I would like the function to take a parameter from a box in excel, something like this: Is this a possibility? And if so how do I write the code? I would prefer not to use UDF. Answer You can do that in two ways: 1) By