Filter Excel table by colour

Well, it is possible to do that with the help of Python’s Openpyxl (like with so many Excel manipulation tasks in and around KNIME).

Basically what happens is this:

  • Import the Excel file into python
  • activate the “Sheet1”
  • find the edges, in this case, the no of rows
  • iterate thru all of the cells with data in column A
  • extract the style information (that was some piece of work)
  • Store them in the corresponding column C
  • check if the style information contains the specific colour we want to see (you could drop that once you are comfortable with the solution)
  • if yes write TRUE if not FASLE into column B
  • save the Excel file under a new name (so you might keep your original file)
  • check the results

You could adapt that to more style information

Please note within the workflow is a subdirectory that contains a Jupyter notebook I used to first explore the functions. And it is possible that this is not the most elegant way :slight_smile: - I wanted to demonstrate that it can be done.

And yes. Excel offers a native solution to filtering such data. So another possibility might be to filter your data before loading it into KNIME.

2 Likes