Reading Column names from file & adding columns to Excel

I have a scenario where I have an excel file and I need to add 10 columns into it. However, is there any way where I can read the column names to be added from a .txt file or excel file and then add those columns in my excel file in a loop?

You could read this entry and thread that deals with adding information to Excel.

The baseline if you do not wish to load and write back the data your options are limited to the use of Python.

In the end excel is useful in many regards but only a sorry excuse for a database.

1 Like

Hi @Pearlb,

as @mlauber71 pointed out one way is to read your data from Excel file into KNIME. Then add columns and write down data to Excel file. And yes, column names you can read from .txt file or excel file. Maybe you don’t need a loop for this but it depends on your logic :wink:

If you decide to go with above approach and have difficulties inserting new columns I can make you workflow examples to get you started.


1 Like

Hi @ipazin,

i could add cols and write data but that would be repetitive task, hence I was looking for a loop kind of solution where all of them would be added.

Could you share the steps as to how to read column names from a txt file and then add those columns into the excel?

My ultimate task why I need the loop is that once the 10 columns are added into the excel, I have to perform a VLOOKUP on those columns and repeating the same steps for all 10 columns wouldn’t be a correct solution.

Hi there @Pearlb,

sry for delayed response. Here is simple workflow example how to read names for new columns and appending them to existing data from Excel file.

2020_02_24_Reading_Column_Names.knwf (17.7 KB)

Now you need to populate those columns and write all data back to Excel file? Wasn’t sure so haven’t added any logic to it.

Hope it helps!


1 Like

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