Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用powershell操作Excel_Excel_Powershell_Cmd_Automation - Fatal编程技术网

使用powershell操作Excel

使用powershell操作Excel,excel,powershell,cmd,automation,Excel,Powershell,Cmd,Automation,大家好,我们正在尝试自动化一些Excel,但是遇到了一些错误,所以我们有下面列出的脚本,但是我们遇到了3个不同的错误 有人能帮我们确定脚本哪里出错了吗 我们得到的错误是: Exception calling "Open" with "1" arguments : "Server error. (excpetion HRESULT: 0x80010105 (RPC_E_SERVERFAU LT))" C:\Users\Montage\Desktop\blockadp.ps1:9 char:3

大家好,我们正在尝试自动化一些Excel,但是遇到了一些错误,所以我们有下面列出的脚本,但是我们遇到了3个不同的错误

有人能帮我们确定脚本哪里出错了吗

我们得到的错误是:

Exception calling  "Open" with  "1" arguments : "Server error. (excpetion  HRESULT: 0x80010105 (RPC_E_SERVERFAU
LT))"
C:\Users\Montage\Desktop\blockadp.ps1:9 char:34
+ $workbook = $excel.workbooks.open <<<< ($excelMacrosFile);
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

Cant call a method with  NULL.
C:\Users\Montage\Desktop\blockadp.ps1:10 char:39
+ $worksheet = $workbook.worksheets.item <<<< (1);
    + CategoryInfo          : InvalidOperation: (item:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "Run" with "31" arguments: "server error. (excpetion from HRESULT: 0x80010105 (RPC_E_SERVERFAU
LT))"
C:\Users\Montage\Desktop\blockadp.ps1:11 char:11
+ $excel.Run <<<< ("Convert", $inputExcelFile, $outputADSFile);
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

cannot call a method with NULL.
C:\Users\Montage\Desktop\blockadp.ps1:13 char:16
+ $workbook.close <<<< ();
    + CategoryInfo          : InvalidOperation: (close:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
即使我只尝试这个“

然后我仍然得到同样的错误

Exception calling "Open" with "1" argument(s): "The server threw an exception. (Exception from HRESULT: 0x80010105
(RPC_E_SERVERFAULT))"
它也不是下面提到的权限,因为它可以工作:

$test = Get-Content 'C:\Users\Montage\Desktop\25.05.17.xls

问题是安装的Microsoft Office版本是x86。 当系统本身为x64时


在x64 office上测试该脚本时没有显示任何错误,脚本按预期工作。

很难破译西里尔字母。也许你能把它们翻译给我们?看起来其中一个提到某个内容包含Null搜索第一个错误时,会显示权限问题。其他错误是follow-up'sCan-you-example do a$test=Get-Content'C:\Users\Montage\Desktop\25.05.17.xls'?这将巩固一个事实,那就是它不是权限——至少在文件级别上是这样——这就是问题所在。我同意,这听起来不像是权限问题。下一步是验证所有变量中的数据,直到得到错误。一次运行一行。然后您将更接近答案在打开工作簿之前,您是否尝试通过
$excel.calculation=-4135禁用自动计算?
Exception calling "Open" with "1" argument(s): "The server threw an exception. (Exception from HRESULT: 0x80010105
(RPC_E_SERVERFAULT))"
$test = Get-Content 'C:\Users\Montage\Desktop\25.05.17.xls