Power Query(M) 示例
let
Source = Folder.Files("\\jsds1.live\dfs\Userprofiles\ixh500\UPM_Profile\desktop\PQ Desktop Demos\Set 2"),
#"Lowercased Text" = Table.TransformColumns(Source,{{"Extension", Text.Lower}}),
#"Filtered Rows" = Table.SelectRows(#"Lowercased Text", each ([Extension] = ".csv")),
#"Combined Binaries" = Binary.Combine(#"Filtered Rows"[Content]),
#"Imported CSV" = Csv.Document(#"Combined Binaries",[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV"),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"TranDate", type date}, {"Account", Int64.Type}, {"Dept", Int64.Type}, {"Sum of Amount", type number}})
in
#"Changed Type"
(打开文件夹中的所有文件,过滤 CSV 文件,打开并组合所有 CSV 文件并设置列数据类型。请注意,这些代码都不是手动输入的,而是通过单击 Power Query Editor 中的图标生成的。)