Rename column with text field

Hello Together,

I am working on a similar data set like this:

When I load this excel file into KNIME and specify the row with column names,
application takes the column names as: A, B, C, D, E, X_1, X_2, X_3, X_4

However, I want my columns to be called as : A,B, C, D, E, F, G, H, I

I am aware that I can use column rename node to rename columns X_1, X_2, X_3 , X_4 as F, G, H,I respectively. But that does not solve my problem because names of columns F, G, H, I can be different everytime.

Therefore I want application to pick up names in the cells F, G, H, I as column names insted of X_1, X_2, X_3 , X_4 automatically.

That will be very helpful.
Thank you in advance

Best regards

Hi @Yuvraj,

maybe a very basic idea how to do it (cannot test at the moment - so might have an error in there :))

-Read in Excel with No Header option (so header is not set from first row)
-Split first two rows from imported table (so your header values)
-Transpose table (so generic header, header row1, header row2 should be in one row)
-Use rule engine to calculate your indended header e. g.
Missing headerRow1 -> headerRow2
1=1 -> headerRow1

-Use the insert header node to set your calculated header.
Lookup should be rowid, value your calulated header value

Maybe that will at least give you a lead on how to solve your problem :slight_smile:

*However these table structures are not great for knime - so another solution could be to change the input file format if possible (I know - most of the times you have to work with the given file format and cannot change it :p)


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