is there a way to move the column header down?

Hello, I’m curious how would I move the column header down, making it into a row? I tried to use the extract column header, but after i do not know if i can even add it back as a new row, any ideas oh how i would do it?
thank you very much for your time

Hi @Bleck , yes this is definitely possible. I created a component for this a while ago, when I was regularly copying/pasting data from Knime to a worksheet for some presentation, and could not copy table headers from Knime.

Basically, you separate the table headers and the body using the Extract Column Header, and then just concatenate both:
image

EDIT: Just to add: The above solution will move the headers to the first row, but the column headers will end up being replaced with generic names (Column 1, Column 2, etc)

Original table:
image

Results:
image

If you want to still keep the headers after moving them, you can do it this way:
image

Results:
image

Here’s the workflow (I included both ways in my workflow):
image
Move column header to first row.knwf (15.3 KB)

6 Likes

thank you very much this didnt just solve this problem i was having but 2 more, no joke
thank you once again

1 Like

No problem @Bleck , you are most welcome.

1 Like

@bruno29a 's solution is descriptive and helpful as always and certainly a good option.

Beside this is depends on your data source.
With Excel or Textfiles or Code Snippets you can just uncheck the header option and “demote” the headers when creating your knime table.
br

2 Likes

Hi @Bleck , I created a component for this where you can choose to Copy or Move the headers.

I’ve shared it on the hub as Copy or Move column headers to first row

@takbb , I’ve created an icon for this component thanks to your guide. @ipazin , @ScottF , my first workflow added to the hub :smiley:

5 Likes

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