发现以前理解错了,不用转格式也可以很快。 | | | $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 |
|