Я начну с того, что не думаю, что это возможно, потому что там есть тип Int64. Я полагаю, что вы можете программно изменить только эти примитивные типы
type null, which classifies the null value
type logical, which classifies the values true and false
type number, which classifies number values
type time, which classifies time values
type date, which classifies date values
type datetime, which classifies datetime values
type datetimezone, which classifies datetimezone values
type duration, which classifies duration values
type text, which classifies text values
type binary, which classifies binary values
type type, which classifies type values.
type list, which classifies list values
type record, which classifies record values
type table, which classifies table values
type function, which classifies function values
type anynonnull, which classifies all values excluding null
Тем не менее, при условии, что у вас есть TransformationTable и CSVTable, этот код (а) перечислит столбцы в CSVTable (б) объединит таблицу преобразования (c) Раскройте слияние (d), вытяните только столбец типа (e) добавьте префикс (f) оцените результат выражения, чтобы сделать его пригодным для использования (g) используйте List.Zip для создания парного набора списков столбца и типа ( h) переименование на основе List.Zip
let Source = CSVTable,
//List of column names
Columns=Table.ColumnNames(Source),
// Merge in Transformation table to get types for each column
#"Merged Queries" = Table.NestedJoin(Table.FromList(Columns),{"Column1"},TransformationTable,{"Field"},"TransformationTable",JoinKind.LeftOuter),
#"Expanded TransformationTable" = Table.ExpandTableColumn(#"Merged Queries", "TransformationTable", {"Directive"}, {"Directive"}),
// Pull just the column with types in it
Directives=Table.Column(#"Expanded TransformationTable","Directive"),
// Add a prefix and evaluate the expression to make it usable
Directives2 = List.Transform(Directives, each Expression.Evaluate("type " & _)),
// Convert the column names and types to a paired list
TransformList = List.Zip({Columns, Directives2}),
// Convert the column names to the types
TypeTable= Table.TransformColumnTypes(Source, TransformList)
in TypeTable