|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- let
- 源 = Excel.CurrentWorkbook(){[Name = "表1"]}[Content],
- 更改的类型 = Table.TransformColumnTypes(
- 源,
- {
- {"CHASSIS ", type text},
- {"DATE", type date},
- {"LOCATION", type text},
- {"TYPE OF ISSUE &#(lf)DESCRIPTION", type text},
- {"Immediate corrective action ", type text}
- }
- ),
- 去除的文本 = Table.TransformColumns(
- 更改的类型,
- {
- {"LOCATION", Text.Trim, type text},
- {"TYPE OF ISSUE &#(lf)DESCRIPTION", Text.Trim, type text},
- {"Immediate corrective action ", Text.Trim, type text}
- }
- ),
- 自定义1 = List.Accumulate(
- List.Skip(Table.ColumnNames(去除的文本), 2),
- 去除的文本,
- (x, y) => Table.TransformColumns(x, {y, each Text.Split(_, Text.Repeat("#(lf)", 2))})
- ),
- 已添加自定义 = Table.AddColumn(
- 自定义1,
- "自定义",
- each Table.FromColumns(
- {[LOCATION], [#"TYPE OF ISSUE &#(lf)DESCRIPTION"], [#"Immediate corrective action "]},
- List.Skip(Table.ColumnNames(去除的文本), 2)
- )
- ),
- 删除的其他列 = Table.SelectColumns(已添加自定义, {"CHASSIS ", "DATE", "自定义"}),
- #"展开的“自定义”" = Table.ExpandTableColumn(
- 删除的其他列,
- "自定义",
- {"LOCATION", "TYPE OF ISSUE &#(lf)DESCRIPTION", "Immediate corrective action "},
- {"LOCATION", "TYPE OF ISSUE &#(lf)DESCRIPTION", "Immediate corrective action "}
- )
- in
- #"展开的“自定义”"
复制代码 |
|