Filter Excel table by colour

Hi, I have a table in excel which I need to filter the colour by “no fill” in Knime.

Thanks in advance

Example.xlsx (8.5 KB)
I attached an example.
Below is what I am expecting
image

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

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.