How to automate and rename 2 separate column headers

Hi I have a work flow here that I run on a monthly basis.
When I have the new data I want the data to be renamed as “Latest Forecast”
and the month before, I want it to be renamed as “Previous Forecast”
automatically based on table row to variable.

I was able to automate this when I rename only one column, but this does not appear to work when I want to rename 2 columns.

Any suggestions appreciated.

WorkFlow_Test.knwf (24.3 KB)

It seems like the Excel file didn’t get attached, so I can’t see what’s going on. Can you share that file with us? If not, dummy data is fine as well.

I can make an educated guess though. The node configuration suggests that the reason it’s not working is that the Table Row to Variable only takes the first row and transfers it into variables.
I’m not sure I want to provide a solution for that, because I believe you want the renaming to be done automatically? A dynamic solution would need a different approach, because the Rule Engine has the rules hardcoded.

Something like:

  • find out which month the data is from
  • identify column of current and previous months
  • rename columns

If my assessment is correct, can you also provide the desired output? It will make providing a solution easier.


Please find Workflow again with Data attached.

WorkFlow_Test.knwf (24.3 KB)

In terms of output I just want March to automatically change to Previous Forecast,
and April to change to latest forecast.

However I want this to by dynamic, when I have new data being added. For example May data, the workflow will rename May as Latest Forecast, and April as Previous Forecast.

Also the other Months headers to be left as it is.


The column names don’t allow unique identification (the year info is missing), so there’s no way of knowing which columns to rename based on their names. Instead I’ll rename the last/rightmost columns:

  1. get table specifications
  2. reverse order
  3. rename first two rows using a Rule Engine. other rows are unchanged
  4. insert new column names into table

rename last columns.knwf (12.3 KB)


Bril, it works perfectly.

Cheers for the solution.
Much appreciated @Thyme


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