Power Query
published
Search
⌃K

Table.TransformColumns

Table.TransformColumns

Applies transformation(s) of the form { column, transform }.
function (table as table, transformOperations as list, optional defaultTransformation as nullable function, optional missingField as nullable any) as table

Description

Returns a table from the input table by applying the transform operation to the column specified in the parameter transformOperations (where format is { column name, transformation }). If the column doesn't exist, an exception is thrown unless the optional parameter defaultTransformation specifies an alternative (eg. MissingField.UseNull or MissingField.Ignore).

Category

Table.Transformation

Examples

Transform the number values in column [A] to number values.
Table.TransformColumns(Table.FromRecords({[A="1", B=2], [A="5", B=10]}),{"A", Number.FromText})
Table.FromRecords({[A=1, B=2], [A=5, B=10]})
Transform the number values in missing column [X] to text values, ignoring columns which don't exist.
Table.TransformColumns(Table.FromRecords({[A="1", B=2], [A="5", B=10]}), {"X", Number.FromText}, null, MissingField.Ignore)
Table.FromRecords({[A="1", B=2], [A="5", B=10]})
Transform the number values in missing column [X] to text values, defaulting to null on columns which don't exist.
Table.TransformColumns(Table.FromRecords({[A="1",B=2], [A="5", B=10]}), {"X", Number.FromText}, null, MissingField.UseNull)
Table.FromRecords({[A="1", B=2, X=null], [A="5", B=10, X=null]})
Transform the number values in missing column [X] to text values, erroring on columns which don't exist.
Table.TransformColumns(Table.FromRecords({[A="1",B=2], [A="5", B=10]}), {"X", Number.FromText})
[Expression.Error] The column 'X' of the table wasn't found.