Is there anyway to colour or format a table to be exported to Excel in Knime?
I’ve had a look at the “color management” nodes, but I think that is just for when you view it in Knime and not for when you export a table to Excel.
Any advice would be great.
If you download the Erlwood nodes from the Community Contributions then you should have an XLS Coloured Writer node that:
“Writes an XLS file. You can customise the background colour of the cells in the XLS file by using the colour tab in the node configuration. For dialog and ports description, see “XLS Writer” node.”
Does this help?
Do you know where I can download Erlwood nodes from? I’ll let you know if it does the trick.
You could use Python and openpyxl but maybe that is a bit of an overkill … but the necessary functions should be there
Still I point you to two examples
well … there is a way. You could use the Python module
openpyxl and open the stored excel file in Python and do some manipulations and then save it again. Openpyxl offers a wide range of possibilities.
Please be aware that this might not be the most stable way, and it could get tricky if you have large or complicated Excel files.
kn_example_python_excel_manipulate.knar (54.5 KB)
I attached a workflow that uses your example to create an Excel file via Python. And also one from the example from before. I think you have to provide the Python Script with a valid path (in this case I used the path of the workflow) and you have to close the file at the end.
kn_example_python_excel_drop_down.knwf (21.4 KB)
Thank you for the examples
I wasn’t able to access the first link from my works computer, but I could download both of the files.
I get the flowing error when I try to run it:
Execute failed: Could not start Python kernel. Error during Python installation test: Could not find python executable at the given location: python3… See log for details.
I might have to install python again.
the Erlwood nodes can be found in the Community Extensions. You need to have the proper update site enabled in the KNIME preferences. See here
https://www.knime.com/community for more details.
Yes you would have to set up Python and connect it to KNIME. Although I did not use a special environment with 3.5 but just the standard Anaconda. Yet I only use the official “conda update anaconda” command to update the environment in order to keep the version of the packages in sync (let Anaconda do that).
And you would have to install openpyxl package