I am very new to KNIME and I am having trouble implementing the following loop:
I’d like to read all the Excel tables in a folder and create a csv table for each of them that has the same name as the original, only with .csv insteal of .xlsx of course.
So far I have a List Files/Folders → table row to variable loop start → excel reader → a bunch of column filters → CSV writer, but I am not sure which loop end node ot add. I suspect I have to have the loop end connected “in parallel” to the writer so that it doesn’t concatenate all the tables, but I am still unsure how to do this.
I suspect you need the Variable Loop End node here. This type of loop end node is useful when you don’t need to collect all the iterated data in a table, because the “magic is happening” somewhere else (in this case, filtering and writing files).
As long as you have the CSV Writer inside the loop, then it’s going to write to different CSV files, as long as to give it a different file name (basically same file name as original file, except for the extension).
For the loop end, you can use the Variable Loop End since you are going with Table Row To Variable Loop.
I put something together for you, and it looks like this:
I think this is what I needed. I am not sure what I was thinking, because I definitely tried the variable loop end, but I must have used it wrong. Thanks!
Thanks to you too! I definitely needed the Variable Loop End, but I think I probably wasn’t getting how that worked exactly. My humble opinion is that sometimes the definitions and explanations on the nodes are a bit difficult to grasp when you are so new to Knime. However I am really getting to appreciate the tool. Thanks for you help!
Yes this was exactly my problem. I don’t think I had completely understood how to close my loop. I still have a question regarding the loop end, though: is there a way that I can edit the ending condition? I understand that this loop (the one I am using is very similar to the answer I marked as solution, basically just connecting the loop end node as you said) will stop when all the input files are read and transformed into csv, am I wrong? This is what I want, but for didactic purposes I would like to know how to change it
Hi @rita_vp , it’s always a good idea to show or share your workflow when you have a problem, which would allow us to point out what the issue might have been.
There are various ways to end a loop, but in this case, since the last operation is the CSV Writer, it made sense to use the Variable Loop End, as the CSV Writer does not have any output, except for the flowvariable (all nodes have flowvariable input and output ports). Had the last operation have a dataflow as output, for example String Manipulation, it would have made sense to use the Loop End instead.