Copy and Paste Table Column Headers

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:

  1. No headers, tab separated text (default)
  2. Include headers, tab separated text
  3. No headers, insert statement or in clause formatted text
  4. 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.

I’m running KNIME on Windows 10.

It doesnt answer your question directly, but if you want to put your table into Excel to share with colleagues, then have you looked at the Excel Sheet Appender node (see https://nodepit.com/node/org.knime.ext.poi2.node.write2.XLSAppenderNodeFactory), or the Report tool?

Steve

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.

2 Likes

Hi Edlueze,

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.

Martin K.

image

2 Likes

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.

1 Like

Nice suggestions! Thanks!

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?

Agree with @DiaAzul. It would be useful.

Hello @DiaAzul, @izaychik63 and others,

this is possible from version 4.2.0.

TableCopyMenu

Br,
Ivan

4 Likes

@ipazin
Many thanks. I hadn’t seen that feature mentioned in any of the release notes, much appreciated.

1 Like

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:

Br,
Ivan

1 Like

Thank you, Ivan. The possibility was miss as it expected to be on popup menu as in other application. Anyway, it is grate.

2 Likes

What exactly is a popup menu?

First, you marc a block to copy. Then right-click inside the block and see the copy item on popup menu.

Ok. I see. But there’s no right-click menu at all in table view. Who knows maybe that changes one day.