- let
- 源 = Excel.CurrentWorkbook(){[Name = "表1"]}[Content],
- 自定义1 = Table.ReplaceValue(
- 源,
- "",
- "",
- (x, y, z) =>
- [
- a = List.Select(Text.Split(x, "#(lf)"), each _ <> ""),
- b = List.Transform(
- a,
- each [
- c = List.Select(Text.SplitAny(_, ",,。 ;;"), each _ <> ""),
- d = List.Combine(
- List.Transform(
- c,
- each Splitter.SplitTextByCharacterTransition(
- {"m"},
- {"订"}
- )(Text.Remove(_, {":", ":"}))
- )
- ),
- d2 = {"长", "宽", "高"},
- e = List.Transform(
- d,
- each
- if Text.Contains(_, "尺寸") then
- [
- f = Text.SplitAny(
- Text.Select(
- _,
- {"0" .. "9", "*", "."}
- ),
- "*"
- ),
- g = List.Accumulate(
- {0 .. 2},
- {},
- (x, y) =>
- x
- & {
- d2{y}
- & Text.From(
- f{y}
- )
- }
- )
- ][g]
- else
- _
- ),
- h = List.Combine(
- List.Transform(e, each if _ is text then {_} else _)
- ),
- i = List.Zip(
- List.Transform(
- h,
- (m) =>
- Splitter.SplitTextByCharacterTransition(
- {"一" .. "龥"},
- {"A" .. "z", "0" .. "9"}
- )(m)
- )
- ),
- j = Table.FromRows({i{1}}, i{0})
- ][j]
- )
- ][b],
- {"列1"}
- )[列1],
- 自定义2 = List.Combine(自定义1),
- 自定义3 = Table.Combine(自定义2)
- in
- 自定义3
复制代码 |