How to change multiple columns elegant?

I’m working with a sheet which contains multiple with data in a format which must be processed:

  • Percentage values in the format “12.5%”
    Here the target format shall be “12.5”
  • Values in the format “2’123”
    This shall be converted to “2123”

I was able to make these substitutions with multiple string node (e.g. “String Replace” and “String Manipulation”). This works quite well and brings the results wanted.
But all of the node I found and tried work only on one column a time. So the workflow requires lots of nodes just for these replacements.

That’s why I do not feel very happy with this solution.

Is there a more elegant way to make those substitution?
Does a node exists which can work on multiple columns a time (with the same substitution rule)?
Anythig else?

Use


node.

4 Likes

Thank you for this proposal.
I have checked this node. Yes it does reduce the amount of nodes as requested by me. But the overall configuration effort is not really reduced as you have to define aan expression per column. And these expressions are the same in my case (except the column itself).

My question was arising from regular adaptations of the workflow due to changes in the underlying data.
I have found the Insert Column Header node


This node allows together with a configuration table (e.g from an EXCEL file) to rename multiple columns within the node.

After renaming the columns there is no need to change the further processing in the workflow. The workflow is always using the columns by the given name (a huge advantage compared with EXCEL).

2 Likes

Hi @knimediger,

if you want to replace several strings in multiple columns you might:

  1. Use Column List Loop Start / End in conjunction with the String Replace OR
  2. Unpivot the whole table, apply your String Replacer, Pivot and Regex Rename the columns

Kind regards
Mike

1 Like

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