返回列表 发帖
#@&cls&powershell "type '%~0'|out-string|iex"&pause&exit
$fn='aaaaaa.xlsx'
$a=new-object -com excel.application
$a.visible=1
$b=$a.workbooks.open("$(dir $fn)")
$c=$b.sheets.item(1)
$d=$c.usedrange
$e=@{}
for($i=4;$i -lt $d.count;$i+=3){
$f=$d.cells.item($i)
$e[$f.next.text]+=,$f.text
}
$i=3
$e.keys|%{$d.cells.item(($i+=3)).value()="$_ "+($e[$_] -join '、')}COPY
如果内容太多用转csv的方式会快一点
1

评分人数

TOP

发现以前理解错了,不用转格式也可以很快。
#@&cls&powershell "type '%~0'|out-string|iex"&pause&exit
$fn='aaaaaa.xlsx'
$a=new-object -com excel.application
$a.visible=1
$b=$a.workbooks.open("$(dir $fn)")
$c=$b.sheets.item(1)
$d=$c.usedrange.cells.value()
$i=$d.length/($d.rank+1)
$e=@{}
1..$i|%{$e[$d[$_,2]]+=,$d[$,1]}
$i=1
$e.keys|%{$d[($i+=1),3]="$_ "+($e[$_] -join '、')}
$c.usedrange.cells.value()=$dCOPY

TOP

第10行漏了个下划线补上应该可以了
1..$i|%{$e[$d[$_,2]]+=,$d[$_,1]}COPY

TOP

返回列表