RenameColumns functions in Power Apps

The AddColumns, DropColumns, RenameColumns, and ShowColumns functions in Power Apps are used to shape the table by adding, dropping, renaming, and selecting its columns. All these functions, results in a new table, but note that the original table that is our data source is not modified at all by these functions.

RenameColumns Function

The RenameColumns function is used to manipulate the name of the column within our app but not within our data source. A common use is when the data source, which we cannot edit, has difficult to reference column name or the column name uses reserved words, like "Date".

Power Apps Syntax RenameColumns(Table, OldColumnName1, NewColumnName1 [, OldColumnName2, NewColumnName2, ... ] )

Note: The column name should be in single quotes if the column name has space in its name otherwise, we can omit the single quotes (for example, Name and ‘Total Marks’).

The old name must already exist in the table, and the new name must not exist. Each column name may appear only once in the argument list as either an old column name or a new column name. To rename a column to an existing column name, first drop the existing column with DropColumns, or rename the existing column out of the way by nesting one RenameColumns function within another.
Note that the Collect function can take the contents of your data source and store them into a collection.

Power Apps Formula

ClearCollect(MyRenameCollection, RenameColumns('Teachers Data', 'Teacher salary', Salary))

The above formula will create a collection variable named MyRenameCollection that stores all the rows of data from the data source, 'Teachers Data'. If the data source has a column named 'Teacher salary', the column is renamed to Salary.

RenameColumns Function in Power Apps

Set the Items property to the collection variable MyRenameCollection.

RenameColumns Function in Power Apps

The third label is used to specify the Salary. Set the Text property to the formula ThisItem.Salary.

RenameColumns Function in Power Apps