- let
- 源 = Excel.Workbook(File.Contents("C:\下载文件夹\问题\问题.xlsx"), null, true),
- #"总功课表(教师名字版)_Sheet" = 源{[Item="总功课表(教师名字版)",Kind="Sheet"]}[Data],
- 更改的类型 = Table.TransformColumnTypes(#"总功课表(教师名字版)_Sheet",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}, {"Column13", type text}, {"Column14", type text}, {"Column15", type text}, {"Column16", type text}, {"Column17", type text}, {"Column18", type text}, {"Column19", type text}, {"Column20", type text}, {"Column21", type text}, {"Column22", type text}, {"Column23", type text}, {"Column24", type text}, {"Column25", type text}, {"Column26", type text}, {"Column27", type text}, {"Column28", type text}, {"Column29", type text}, {"Column30", type text}, {"Column31", type text}, {"Column32", type text}, {"Column33", type text}, {"Column34", type text}, {"Column35", type text}, {"Column36", type text}, {"Column37", type text}, {"Column38", type text}, {"Column39", type text}, {"Column40", type text}, {"Column41", type text}, {"Column42", type any}}),
- 删除的顶端行 = Table.Skip(更改的类型,3),
- 删除的列 = Table.RemoveColumns(删除的顶端行,{"Column42"}),
- 逆透视的列 = Table.UnpivotOtherColumns(删除的列, {"Column1"}, "属性", "教师"),
- 删除的列1 = Table.RemoveColumns(逆透视的列,{"属性"}),
- 重命名的列 = Table.RenameColumns(删除的列1,{{"Column1", "班级"}}),
- 分组的行 = Table.Group(重命名的列, {"班级", "教师"}, {{"计数", each Table.RowCount(_), Int64.Type}}),
- 合并的列 = Table.CombineColumns(Table.TransformColumnTypes(分组的行, {{"计数", type text}}, "zh-CN"),{"教师", "计数"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"已合并"),
- 分组的行1 = Table.Group(合并的列, {"班级"}, {"教师", each Text.Combine([已合并],",")}),
- 按分隔符拆分列 = Table.SplitColumn(分组的行1, "教师", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"教师.1", "教师.2", "教师.3", "教师.4", "教师.5", "教师.6", "教师.7", "教师.8", "教师.9", "教师.10", "教师.11", "教师.12", "教师.13", "教师.14", "教师.15", "教师.16", "教师.17", "教师.18", "教师.19", "教师.20", "教师.21", "教师.22", "教师.23", "教师.24"})
- in
- 按分隔符拆分列
复制代码 "C:\下载文件夹\问题\问题.xlsx"改成自己的地址
|