Power Query M code
let
Source = YourTable,
ColumnList = Table.ColumnNames(Source),
ChangedType = Table.TransformColumnTypes(Source, List.Transform(ColumnList, each {_, type text}))
in
ChangedType
Changes the type of every column in a table to text in one step, useful before exporting or comparing rows.
let
Source = YourTable,
ColumnList = Table.ColumnNames(Source),
ChangedType = Table.TransformColumnTypes(Source, List.Transform(ColumnList, each {_, type text}))
in
ChangedType
Table.ColumnNames reads the table's current columns automatically, so this keeps working even if columns are added or removed later.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Convert Every Column to Text.