且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PowerShell将整个工作表复制到另一个工作表

更新时间:2023-11-27 18:28:28

如果只想复制内容,则不能使用 Copy() Range 对象(特别是 Cells 集合)的 方法:

If you just want to copy the content you can't use the Copy() method of the Worksheet object. Use the Copy() method of the Range object (specifically the Cells collection):

$wb_source.Sheets.Item($SourceSheet).Cells.Copy()
$wb_target.Sheets.Item($TargetSheet).Cells.PasteSpecial(-4163)