Process files with different templates

Hi, I have several files and some files has some different column headers ( meaning the column name was added or renamed). I’m trying to automate a process that will read all these files and output new files with the same template. But I’m getting errors because one file might not have the column that I’m trying to remove a column that doesn’t exist and how I add a column that doesn’t exists in the original file
For example:
file A: column 1,column 2,column 3
file B: column 1,column 2,column 3,column 4
file C: column 1,column 2,column 4,Column 5

I want o output 3 new files with the following layout : column 1,column 2, column 3, column 4

thanks,
Renata

Hi Renata and welcome to the Community!

As far as I can see, there are two cases in your example:

1) Columns are missing and need to be added

In this case, use the approach shown in this example here: Optional calculations with columns

2) Columns exist but need to be renamed

In this case, you can use the “Rename with lookup” action that renames columns according to a lookup table. In that lookup table you can collect all combinations how columns should be renamed, for instance

Old name New name
Column 5 column 4

Another possible case could be when column names are completely irrelevant, only their position matters. If that’s the case, let me know and will provide an example.