Help - Loop // Add Column

Hey I am new and need some help.

I have to consolidate different excel files in a folder. For that I would like to load all files and add in a column the file name and give it back in one xlsx file. Can somebody help?

Thanks so much.
Andy

There is an example workflow on the KNIME hub which should give you some help:

You would need to exchange the File Reader node for an Excel Reader node:

and follow that before the loop end node with a Variable to Table Column node, which you need to select the file path column variable (NB you can only do this once the loop start node has been executed):

After the loop end, add an Excel Sheet Appender node to write out your combined sheet:

Steve

3 Likes

Hey Steve,

great! It works!! :slight_smile:

Thank you so much.
Andy

2 Likes

Hi there @Andy1981,

welcome to KNIME Community!

Just to add that with new Excel Reader node (available from KNIME version 4.1.0.) you can read/import multiple files without using loop! Choose Files in folder option and specify folder :wink:

Doesn’t have option to add file name into new column but considering it is pretty frequent and reasonable request when consolidating data have added feature request for it (internal reference: AP-13949).

Edit: See here for adding file identifier without looping.

Br,
Ivan

1 Like

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