Excel Reader is not reading files individually

Hi, I just wanted to ask for some guidance on how to configure my KNIME workflow so that it reads excel files in one folder individually, processes them, and write each one into a separate file according to their commodity type (present as a column in each file). Right now, the end result is the data I want, but instead of writing each data into individual files according to their commodity code, it writes all the data (consolidated) into all output files renamed to their respective commodities. Here is my current workflow:

Here are my input files:

and here are my output files, which are all the same size because each file contains the identical, consolidated data:

Any help would be appreciated!

It looks to be loop structure issue. It looks as though you have 2 loop start nodes and 1 loop end. Maybe try removing the second loop start in front of the excel writer node?

You can always put some dummy excel files in the workflow data folder and point the reader / writer to it so that the files will be included and the upload an export of the workflow for us to review.

2 Likes

Hi @jauntalan , @icfo is right that your loops are not properly completed, and in addition to that, I’m going to take a guess that the following structure is likely to be what you need.

I’m making an assumption here that all the Excel files have the same basic structure and so can all be read in, within a single loop.

In fact if all the Excel files have the same structure and are in a single folder, you can do away with the first loop altogether as Excel Reader can read all files in a folder, and you have this structure:

The Group Loop (grouped by your “commodity type”), rather than a Table Row to Variable Loop ensures that rows are passed to the Excel Writer in batches for the file to be written. I’m making an assumption that you will somehow be constructing the output path based on category, which is possibly what your original String Manipulation was for, but I’d do this as part of the loop using a String Manipulation (Variable), e.g. something like this:

and then that may get you to more or less where you want to be.

4 Likes

Thanks for guiding me. You guys are right, it was because of my incomplete loops. Thanks too @takbb for the example. I learned a lot. I really appreciate it.

1 Like

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