When I copy cells from the output of a KNIME node onto the clipboard, how can I also copy the column headings?
This is a question I expected to have been asked many years ago, but after searching the KNIME Community I have not yet found an answer. Sorry if this is a duplicate.
What I’d really like to do at the end of a workflow is copy everything from the final node and drop it into an Excel spreadsheet so I can share it with my colleagues.
Instead, what I have to do is copy just the data, then add an “Extract Table Spec” node, copy the headers as a column, then paste-special-transpose at the top of my Excel spreadsheet. It’s quite a process!
I expected to find the option buried deep in the KNIME Preferences, but so far I’ve had no luck finding it.
For reference, the “TOAD for MySQL” tools always pops up the question “How do you want to format copied grid data?” and provides these options:
No headers, tab separated text (default)
Include headers, tab separated text
No headers, insert statement or in clause formatted text
Include headers, insert statement formatted text
There must be others who would also like to copy column headings to the clipboard along with their data? I can’t be the only non-purist data heathen.
You can use a little Python hack in order to achieve your goal. Use a Python Snippet Node and enter the following line of code: output_table = input_table.to_clipboard(excel=True)
Execute the code within the Python Editor with “Execute Script Option”. Then just paste it into an Excel Sheet. You can also choose which separator to use etc. Have a look inside here to get further information: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_clipboard.html
Hope this helps.
If you have no better option than manually copy/paste results into XLSX file, there might be also useful this simple trick. Extract Column header from source table, leave option “Use new output names” unchecked.
Concatenate both tables, upper output from the “Extract Column Header” node has to be connected to the upper input port of “Concatenate” node. Finally, CTRL+A output and copy/paste it into XLSX file.
I believe, it should be added as an option to copy with headers or without. Currently you can copy headers from Spec - Columns tab in the node and paste it in Excel as a column then copy it from Excel and paste on top of your table with paste special transpose.
Can (or how can) this be turned into a feature request?
Copying the table output (with coumn headers) is such a common activity in the development of models that it should be standard feature of KNIME, and is currently one of the greatest omissions. How long would it take to implement a copy to clipboard menu option in the view of a table?
You are welcome. I find that in every release there are useful and cool features that don’t make it to highlights page so you have to look for them in changelog: