-1
みなさん、こんにちは、いくつかのExcelを自動化しようとしており、いくつかのエラーが発生しましたので、下記のスクリプトがありますが、3つの異なるエラーが発生しました。powershellでExcelを操作する
スクリプトが間違っていた場所を特定するのに役立つ人がいますか?我々が得ている
エラーは以下のとおりです。
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
スクリプト自体:私はその後、私はまだ取得この "https://support.jamsscheduler.com/hc/en-us/articles/206191918-How-to-Automate-the-opening-of-an-Excel-Spreadsheet-in-Powershell" のみ
$excelMacrosFile = "C:\Users\Montage\Desktop\friday.xls";
$excel = new-object -comobject excel.application;
$workbook = $excel.workbooks.open($excelMacrosFile);
を試す場合でも
$excelMacrosFile = "C:\Users\Montage\Desktop\friday.xls";
$inputExcelFile = "C:\Users\Montage\Desktop\25.05.17.xls";
$outputADSFile = "C:\Users\Montage\Desktop\25.05.17.adp";
$excel = new-object -comobject excel.application;
$workbook = $excel.workbooks.open($excelMacrosFile);
$worksheet = $workbook.worksheets.item(1);
$excel.Run("Convert", $inputExcelFile, $outputADSFile);
#$workbook.save();
$workbook.close();
$excel.quit();
同じエラー
後述するように、この作品以降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
キリル文字を解読するのは難しいです。おそらくあなたはそれらを私たちに翻訳することができますか?そのうちの1つが何かにNULLが含まれていると言われているようです。 –
詳細な説明は英語ですが、関連性がないと思われますが、とにかく翻訳しました – AudioTroubler
最初のエラーを検索すると、[Q&A on SO] ://stackoverflow.com/questions/33807857/powershell-xls-to-csv-conversion-issue)を参照してください。他のエラーはフォローアップの – LotPings