Combine specific Excel sheets into one Table

Hi, I have an Excel file with 27 sheets in it. I want to combine specific sheet with criteria of sheet name then combine only those sheets. Is there a way to do it?

Hi @adnan171 , and welcome to the Knime Community

You can use the Read Excel Sheet Names node that will give you the list of the 27 sheets from the file.

You can then use the Row Filter or the Rule-based Row Filter nodes to filter the sheets that you want to keep for “combining”.

Then you can use the Table Row To Variable Loop to read from the filtered list

The loop will read from the filtered list and each iteration will convert a row to a variable, and you can then use this variable to override the sheet name in the Excel Reader


image

In the Settings tab, make sure you choose “Select sheet with name”, and you can ignore what’s in the drop down as it will be overriden.

In the Flow Variables tab, you can override the value of the sheet name to use by choosing the “Sheet” variable (this is generated by the Loop)

Once you do this, go back to the Settings tab, and you should see this message at the bottom:

You can then write to a new Excel file, but make sure that you are writing to the same file and same sheet, and make sure you choose to append the data for both file and sheet:

Put everything together in a workflow, something like this would work:
image

3 Likes

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