Read csv from "files in folder" and then go over sheets.

Hi guys,

Thanks to this forum I found how to easily read in changing documents from a folder location.
Now what I have not yet found is how to read in an excel in which there are multiple sheets.

Currently I am doing it like this:
image

But this requires me to specify the specific file in the first node which I want to get away from.
It should just as my other read in’s refer to a folder location as the document name will always remain the same except for the date. So that allows me the filter on a wildcard.

So the other files with only 1 sheet I am reading as follows:


This works fine as there is only one sheet in these files.

Happy to learn!

Kr,

1 Like

Hello @belewa,

use List Files/Folders node to filter/list your file followed by Table Row to Variable which you’ll connect to Read Excel Sheet Names node.

Br,
Ivan

1 Like

Hi Ivan,

Then how should I proceed with the Excel Reader node that is between my loops as this one still refers to a specific file?

Hello @belewa,

then continue with loop. Like this:

ExcelSheetsInALoop

And I suggest not to use deprecated nodes…

Br,
Ivan

Hi Ivan,

Thanks for the help.
My question was more referring to what should the excel reader then refer to ?
Because right now that node still refers to a specific file, which should be constantly updated in the flow - this should be OK regardless of what file was uploaded

The flow should always read in sheet 2 and 3 of the 4 total sheets. So exclude 1 and 4

Kr,

Hi @belewa,

ok. Maybe I figured out what is troubling you. Both Read Excel Sheet Names and Excel Reader nodes should refer to same file returned in List Files/Folders node. This is accomplished by using flow variable of type path created by Table Row to Variable node.
(I’m using the latest 4.3.2 version)

Additionally check this section of new File Handling guide:
https://docs.knime.com/latest/analytics_platform_file_handling_guide/index.html#path-data-cell

Br,
Ivan

Hi Ivan,

I’ve tried quite some things by now and unfortunately it’s still not working.


The row filters etc are there in order to drop the first and last sheet given any # of sheets, so that should remain in.

My Table Row to Variable looks like this:

Both List Files and Read Excel Sheet Names look the same:
image
Referring with a filter option to a wildcard.

The excel reader does not output what I expect.

Thanks for your help

Kr

You excel nodes seem to be older (“deprecated”) so you might want to check out the good old way with 2 variable loop start nodes (1 after read files/folders) and one after the read sheet names. (Kind of similar to Reading Multiple Excel files with different sheet names – KNIME Hub)
bR

1 Like

Hello @belewa,

everything looks fine except Sheet selection configuration. Choose option Select sheet with name and control the sheet name via flow variable on Flow Variables tab.

Br,
Ivan

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