Two header rows in output table

Hello KNIMErs,

My task is to:

  1. Read excel files where column headers are in two top rows.
  2. Compare data between both input files.
  3. Generate single excel output file (with Excel Writer node) where column headers are in two top rows again.

Sample header rows in input files look like this:


Header rows for output file should look the same.

The challenge is with point #3: generate single excel output file where column headers are in two top rows again. I know how to transform two header rows into a single header row, but I don’t know how to keep two header rows in an output excel file and I haven’t found anything like this on the forum.
Any suggestions?

Thank you in advance,
Kaz

Hi @Kazimierz,

Maybe you could adapt the solution implemented in the following topic:

The trick would be to use in a 1st step an -Excel Writer- node to just write the headers and all the rows in a 2nd step using again an -Excel Writer- node to save all the rows but this time configured with the checking of the “append” radio button option, the unchecking of the “Write Column Headers” option and the checking of “Don’t write column headers if sheet exists”.

Hope this helps.

Best
Ael

5 Likes

Hi @aworker
Thank you for your suggestion. I will play with appending rows and share my feedback here.
Best regards,
Kaz

1 Like

Hi @aworker

I can confirm your idea works for me with some extra tweaks. I’m getting excel file with two header rows as per my expectations:

In fact, while building-up header row-by-row, it is possible to create multi-row header, where ‘multi’ stands for >2.

Thank you and happy KNIMEing,
Kaz

2 Likes

Hi @Kazimierz

Thank you for confirming that it worked. I suggested the solution from my mobile phone so I had to guess it by heart out of the hat :sweat_smile:

Thanks a lot too for having validated the solution so that other KNIMErs can easily find it :blush:

All the best and happy KNIMEing too !
Ael

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