Open the excel Sheets you want after dowloading an Excel file once

Hello I need help.
I would like to open an Excel file that contains several sheets once. But each sheet will have a different treatment. For example, if my file contains two sheets, sheet 1 and sheet 2, each sheet will then have its particular treatment. But I don’t want to load the file twice. I tried several solutions but I can’t do it. I have version 4.7.8, I work in a company where it is difficult to download the nodes you want. So apart from Excel Writer and Reader I don’t see any other solutions for me.
thanks a lot for your help

Hi @Louis75 , welcome to the KNIME community,

If the different sheets in your Excel file are a different structure, then I don’t see that you have a choice other than to read each sheet individually, which requires multiple Excel Readers. After all, if you then have a different treatment for each sheet, you presumably will have different workflows, or at least different branches in the same workflow, so each would require its own reader.

A single Excel Reader produces table output for the structure of the specific sheet it is reading.

Perhaps I am misunderstanding your question, but what is the problem with using more than one Excel Reader, that you are trying to address?

1 Like

Thank you for your answer, no you understood correctly, my request. I would just like to avoid manipulation if possible. Because it is a file which is transmitted each time with a new name. So this will necessarily require loading the file as many times as it contains sheets. I can definitely define a neutral name for the file and look for it in a specific file. But if there was a more direct solution I would take it.
Thank you for taking the time to study my request.

Hi @Louis75, OK, I understand better now your reason. If it is to avoid having to enter the filename multiple times, you can create a variable for the name using Variable Creator node and then String to Path to turn it into a Path Variable that Excel Readers can use for the filename, but actually the simplest way, if you are ok with manually editing one Reader is this…

Chain a series of Excel Readers using the flow variable port like this (one per sheet)

image

In the first Excel Reader, give the name of the file, and click on the [V] button and configure the popup dialog to create a variable:

Then in the subsequent Excel Readers, you configure these using the [V] button to use the name of the variable as the file path:

In each of the Excel Readers all you need to do now is configure the sheet, and they will all use the same file name as the first Excel Reader.

2 Likes

Thank you! thank you! thank you! dear @takbb, it looks so simple! how do you do that!!!
you can’t even imagine the hours, I spent trying to find a solution, I was missing information each time. Thank you for taking care to answer me. Before finishing, you were talking about another solution “Variable Creator node and then String to Path to turn it into a Path Variable that Excel Readers” do you have an example, I would like to test it, I will surely need it, one day . :slight_smile:

2 Likes

Hi @Louis75,

Yes to manually create a variable for the file, one way you can do it is like this:

image

Variable Creator

String to Path (Variable)

This creates a Path variable (that Excel Reader can “see”) from a String variable containing a filename. Note the new variable has a suffix added to the name which is “_location” by default, configurable in the above dialog.

Excel Reader
The Excel Reader can then be configured to use this path variable…


NOTE: In KNIME 5.x, using the “Modern UI”, you may find that the Variable Creator node is “missing”. If this occurs, open “Preferences”
image
and then ensure the “All nodes” is selected instead of “Starter nodes”

2 Likes

I will try it, many thanks @takbb!!!

1 Like

It works!!! Well done! Thanks a lot!!

Hi @Louis75 -

Could you click the solution checkbox for the post that helped you most? We like to credit our forum experts properly whenever possible :slight_smile:

1 Like

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