KNIME 4.+ Excel reader > read specific sheets but not all files have that sheet

Hi,

I hope to get ideas on how would you ask KNIME to read a specific sheet in Excel files stored in a folder? Note that not all files in that folder has that sheet that I want so I want KNIME to ignore the files that don’t contain this sheet.

I tried Excel Reader node and selected the sheet name but it returns an error saying Sheet X is not found in File A or something.

Hope you can help.

Thanks,
Ana

Hi!
I think there must be a simple solution but I came up with this.


1º node you have to type the folder where you have the files.
2º node you choose the specific sheet name that you need.
3º node is for cleaning, to have just the “Path”.
4º node must have the Path. It creats the path in a loop, where you feed the excel reader with the created variable.
5º node:

image
With the 6º node you finish the loop.
The last one is to check if the workflow works correctly :smiley:
I am sure there are cleaner solutions.
Hope it helps!
Best regards.

4 Likes

Hello @Ana914,

I assume you are using loop to read files? If so then @jorgemartcaam’s approach is pretty cool (basically two nodes so don’t see a much cleaner solution :wink: ). Another approach can be to add Try/Catch nodes around Excel Reader. This way you can even collect Excel files which don’t have this sheet from Catch Errors flow variable output port.
ExcelwithTryCatch

Br,
Ivan

3 Likes

Thank you so much! I’m new to Loops so this is easier for me to understand :slight_smile:

Thanks, ipazin! I will try the purple nodes to explore and understand them as I’ve never seen them before :slight_smile:

3 Likes

“Purple nodes” lol, I like it :rofl:

1 Like

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