Using a loop to write to the same excel file within different sheets

I currently have a table with 4 columns, one of which being an identifier. The end goal is to output each group of like identifiers to a new sheet within the same excel file. I’m relatively new to KNIME so my understanding of loops isn’t great. My intuition tells me it’s possible to put a row filter within a loop, and then have it iterate through the table based on the identifier variable. Again, I’m relatively new to KNIME so my knowledge of flow variables also isn’t great. I’ve included a screenshot of the input table I wish to split up (by column 1 “LDGR_CO”). Any help would be greatly appreciated.

KNIME2

Hi @JGebhard

You are almost there with your workflow but the -Excel Writer- must go inside the loop and this can be done by using the -Variable Loop End- node:

image

In fact the Row Filter won’t be necessary if you are using the -Group Loop Start- node, as this only takes the rows within the group for the current iteration.

Choose the correct column for the configuration:

Then use the following configuration for the Excel Writer, but alter it to your specific needs:

In the Flow Variables tab of the -Excel Writer- node, you can select the variable for the naming of the sheets. In this case you can use the LDGR_CO variable that was already created by the -Loop Start- node:

Hope that helps you,
Heather

4 Likes

Wow Heather I was not expecting that quick of a response. That was the solution, thank you so much!

3 Likes

No problem, happy to help :slight_smile:

In fact, I have just been working on some sheet appending myself, so it was fresh in my mind!

Thanks for validating my solution :slight_smile:

1 Like

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