I’d like to ask your help in the following: In the attached workflow I take column from file Base. This data I need to insert one by one into file Main Data (column B) instead of current data. After insert of each single data from file Base it should be saved new file with this set. Name of the file in this case should be equal to the data which was inserted at that time (101.xls, 102.xls, etc.)
F.knwf (141.1 KB)
What I can do here to finalize process? Thanks in advance!
Hi @meTan , so you have your Main Data.xlsx starting off like this:
and then you have Base.xlsx that looks like this:
Are columns A and C from Base.xlsx involved or have any effect on what you are trying to do?
When you say you want to insert column B from Base.xlsx one-by-one into the Main Data, what do you mean by that?
Do you mean each individual value of column B in BASE gets applied to all the values in MAIN DATA and then written out to different files like this (for all the different values of B)?
or something else?
Hi @takbb! A bit different:
it should be several separate files where only column B will be changed. In the first file it will be only 101 in column B and file with name 101.xlsx. Then, 102 in column B and file name 102.xlsx, etc. in total it should be as many files as rows in file Base.
Hi @meTan ,
Hopefully the attached does what you are requiring.
I’ve included comments to (hopefully) explain how it works
Merge tables and save rows to multiple excel files.knwf (263.0 KB)
[edit: People might wonder why I used my component “Open File or Folder” to create the local file variable, when there is a KNIME standard node called “Create File/Folder Variables” for this purpose.
e.g. it should really be written something like this.
The reason is “life is too short!”. The Create File/Folder Variables is fine when I know the name of the file to be created, but to pass the file name in as a variable requires that I create three string arrays. One to hold my single variable name, one to hold the file name without the extension, and a third to hold the extension. Now given that there is no built-in support for the easy creation of string array variables, this actually requires a fair bit of jumping through hoops to achieve! Hence… the use of a home grown component
But if anybody does want to do it that way, I can recommend a component for the creation of String array variables. Search the hub for “Create String Array Variable” ]
Tried and it is exactly what I need. Thanks a lot!
Will keep this for future improvements.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.