【问题标题】:Join fields in excel using powershell使用powershell在excel中加入字段
【发布时间】:2016-02-18 19:51:27
【问题描述】:
(1..$numrows) | ForEach-Object {
   $sheet.Cells.Item($_,1) = -join $sheet.Cells.Item($numrows,1) + '-1234';
}

我正在尝试将 -1234 加入 csv 文件的一行中 我的结果是System.__ComObject-1234

您能否告知错误信息?

【问题讨论】:

    标签: csv powershell powershell-2.0 powershell-3.0


    【解决方案1】:

    1 - 您不能使用开关启动表达式,-join 不是命令。使用示例:$myJoinedArray = $array -join ";"

    2 - 你不需要-join+ 足以连接字符串。

    3 - 我想你想要$sheet.Cells.Item($numrows,1).Value

    (1..$numrows) | ForEach-Object {
       $sheet.Cells.Item($_,1) = $sheet.Cells.Item($numrows,1).Value + '-1234';
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-24
      • 1970-01-01
      • 1970-01-01
      • 2020-08-04
      • 1970-01-01
      • 2016-01-11
      • 1970-01-01
      相关资源
      最近更新 更多