Workflow to automatically read XLS files

Hello. I made a workflow that automatically reads all xls’ in a folder without having to specify where the data starts. Just point at folder with files and it combines them all. It does so by ignoring any rows that only have the first two columns filled out and then assigns the first row as the header. I would like to make it dynamic with an if switch to use the file reader when the extension is csv. I could do it in code but don’t understand how to do that with the knime switch nodes.

The workflow also allows merging of columns that have different names using a Table Creator to fields to be renamed so the files are concatenated correctly. So if your files are very similar and you want to merge some fields, it is easy. I can share it once I refine it a bit since it is slow when using big datasets. Maybe someone wants to make it into a functioning node, I don’t know how to configure the wrapper node to create settings.

Hi glenerik,

Your workflow sounds very interesting, it would be great if you could share it!

To learn how to use the If-Switch node in KNIME, please have a look at this example:

https://www.knime.org/nodeguide/control-structures/switches/using-a-if-switch

In your case, you would need to extract the file extension first. Next, the If-Switch node needs a flow variable with the values "top" and "bottom" as input. To get this, you can use a Rule Engine a rule like

extension = "xlsx" => "top"

TRUE => "bottom"

 

Cheers,

Roland

 

Will do. I need that if switch also in case there are no bad rows to ignore, the workflow fails in that case since the row filter loop is blank. I'll share it once I fix those two things