Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Open Excel Error Using PowerShell in SQL Server Agent Job

$
0
0
I am trying to run a Powershell script, which opens and modifies an Excel spreadsheet, from a SQL Agent job step, . The script runs fine by itself, and from BIDS. I have tried running as an SSIS pkg with a proxy, and when that didn't work I setup the step to simply run the Powershell script.This is the error I receive:A job step received an error at line 17 in a PowerShell script. The corresponding line is '$Workbook=$objExcel.Workbookds.Open("\\files\reporting\Dailyreport_MMDDYYYY.xls",0,$False,1,"password")'Correct the script and reschedule the job.The error information returned by PowerShell is: "Exception calling "Open" with "5" arguments(s)."Microsoft Excel cannot access the file "\\files\reporting\Dailyreport_MMDDYYYY.xls".There are several possible reasons: The file name or path does not exist [i](Yes, it does!)[/i]The file is being used by another program [i](No, it’s not!)[/i]The workbook you are trying to save has the same name as a currently open workbook." [i](No again, no workbooks open)[/i]Process Exit Code -1. The step failedIt appears that it does not want to open Excel, but why?FYI: 64-bit System, 64-bit SQL 2008 R2, 32-bit Office 2010. I have already tried adding "Desktop" to SysWoW64 and editing my DCOM settings, with no change in results.Thanks,Lorna

Viewing all articles
Browse latest Browse all 467

Latest Images

Trending Articles



Latest Images