I have a csv file which contains data as shown below:
Now I want to generate 10 output files (one for each row), where each file is named as column1 value e.g. file1 name should be A1.txt and it must contain data B1,C1,D1. Similarly for second row, generate a file with name A2.txt and with data B2,C2,D2 and so on. Please let me know if someone have any leads on how to do it in Knime. Thanks in advance.
Thanks a lot @mlauber71. This solution is somewhat similar to the solution I needed, but not exact. According to your solution, only one text file is created which includes all row values of our excel file. However, I want different file for each row. e.g. if we have 10 rows then 10 text files should be created where each file have name as the values of first column and each file should contain a row data. For more clarity, please refer to the question. Thanks again
Thanks a lot @mlauber71. I really appreciate your help. I am able to do what I needed to do using the workflow attached by you. However, when I am creating workflow myself using the same nodes and with similar settings, I am facing a problem. In “CSV Writer” node when I am configuring it using created flow variable (var_file_name), then it is giving an error “directory of output file does not exist”. I added a screenshot for your reference also. For future work, please let me know how to use this var_file_name variable (created on “Java Edit Variable (simple)” node) in “CSV Writer” node.
in the Java snippet I create the necessary file path and name dynamically. I like to use the KNIME-protocol that works with relative paths which I strongly recommend you would use. It makes sure you can pack and copy your workflow ensemble everywhere and it will still work.
knime://knime.workflow/…/result/
In you case the syntax in the Java Snippet might look like this
if indeed your task2 folder is beneath your current KNIME workflow and has a subfolder called result. If not you would have to specify the location where your CSV files should be stored.