assign columns to specific positions

Hi,

I have a workflow which uses different files every time it is used. It could happen that sometimes not all columns are existing or there are some extra columns. The Export goes into Excel and there other sheets will use the data. So if the positions of the columns change, because of extra oder missing ones, the table does not work anymore. Is it possible to assign every column am specific position (f.e. ID -> 1; Name -> 2; Date -> 3; price -> 4…; extras -> at the end)? And if there is a missing one an empty column ist created? (f.e.: Input: ID; Name; price - Date is missing, so a third column is created empty and the Output is: ID->1; Name ->2 ; date(empty) ->3; price ->4)

Thanks in advance! :slight_smile:

Greetings, David

Hi @DvdFrcK

if all your final columns are known i would try it to solve it as followed.

Predefine a empty table with the table creator which contains all columns with the correct type. Then use the column sorter node to bring it in the right order and finally append your result table.
Including the column sorter node gives you the flexibility to alter your output and unknown/unspecified columns arranged automatically at the end.

BR

2 Likes

Hello @DvdFrcK,

to add to @morpheus solution you would need to use Table Validator (Reference) node cause it has option to create column if missing. Then follow it with Column Resorter resort to have your desired structure :wink:

Br,
Ivan

3 Likes

Thanks both for your answers!

I used a table creator, a Stirng to Date&Time Node and than the Table Validator (Referenz).

1 Like

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