Forum Discussion
How to get powershell script to pull excel file to sql server database when called by sql agent job?
Standalone powershell script for pulling excel to sql server works and also when calling from Task scheduler, but powershell script fails when called from Sql Agent and SSIS(Sql Server Integration Service).
Error message received:
To do that I created a COM object that takes a url(it can be used with a local directory path as well).
$Excel = New-Object -ComObject Excel.Application
$workbook = $Excel.Workbooks.Open($filePath)
$Excel.Visible = $false
After knowing the issue, based on websites, I cleaned the office cache, killed an excel process in the background prior to the execution of this task, but my efforts were futile.
Besides, I split the whole powershell script into pieces and added to command pane in the settings for the step like the following:
ç
Kindly wait for your guidance.
- EricStarkerCommunity Manager
Hello! You've posted your question in the Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the PowerShell space - please post PowerShell questions here in the future.