本帖最后由 pxy0409 于 2024-5-20 10:43 编辑
wps的话,pq或sql均不能使用,所以建议更换为Office
另附pq查询步骤:
let
源 = Folder.Files("C:\Users\Administrator\下载"),
筛选的行 = Table.SelectRows(源, each ([Name] <> "desktop.ini" and [Name] <> "汇总.xls")),
删除的其他列 = Table.SelectColumns(筛选的行,{"Content", "Name"}),
自定义1 = Table.TransformColumns(删除的其他列,{"Content",each Excel.Workbook(_)}),
按分隔符拆分列 = Table.SplitColumn(自定义1, "Name", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Name.1", "Name.2"}),
更改的类型 = Table.TransformColumnTypes(按分隔符拆分列,{{"Name.1", type text}, {"Name.2", type text}}),
按照字符转换拆分列 = Table.SplitColumn(更改的类型, "Name.1", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"Name.1.1", "Name.1.2"}),
删除的列 = Table.RemoveColumns(按照字符转换拆分列,{"Name.2"}),
重命名的列 = Table.RenameColumns(删除的列,{{"Name.1.1", "日期"}, {"Name.1.2", "项目"}}),
#"展开的“Content”" = Table.ExpandTableColumn(重命名的列, "Content", {"Name", "Data"}, {"Name", "Data"}),
#"展开的“Data”" = Table.ExpandTableColumn(#"展开的“Content”", "Data", {"Column1"}, {"Data.Column1"}),
筛选的行1 = Table.SelectRows(#"展开的“Data”", each ([Data.Column1] <> null)),
删除的列1 = Table.RemoveColumns(筛选的行1,{"Name"}),
重命名的列1 = Table.RenameColumns(删除的列1,{{"Data.Column1", "姓名"}}),
筛选的行2 = Table.SelectRows(重命名的列1, each ([姓名] <> "姓名"))
in
筛选的行2
|