Run Excel Macro using SSIS throught SQL Jobs failed - excel

I have a task to create Excel VBA and run that macro on SSIS. I can successfully run the Excel Macro from the SSIS Package, but I have a problem when I run that SSIS on SQL Jobs. I have created Credential, Proxy SSIS, and set SSIS unprotected, but it always fails.
Error Message
Executed as user: HARNANDA7-PC\HARNANDA7.
Microsoft (R) SQL Server Execute Package Utility
Version 11.0.2100.60 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved.
Started: 11:56:14
Error: 2014-05-28 11:56:17.61 Code: 0x00000001
Source: Script
Task
Description: Exception has been thrown by the target of an
invocation. End Error
DTExec: The package execution returned
DTSER_FAILURE (1).
Started: 11:56:14 Finished: 11:56:17 Elapsed:
2.652 seconds.
The package execution failed. The step failed.
but if i create Folder named "Desktop" on C:/Windows/System32/config/systemprofile/ or C:/Windows/SysWOW64/config/systemprofile/
then the SSIS package runs successfully through SQL Jobs.
I'm confused as to what the problem is here. Can anyone help?
Big thanks

For whatever reason (no one seems to know from what I can gather), Excel requires that the desktop folder be present on your machine. It must use it as a global setting or possibly a default setting for creating files or temporary files. If that folder doesn't exists then (and this is just a guess) excel either has issues creating these temporary files or requires that the Desktop directory exists and, in both cases, throws an error if the Desktop directory does not exist.
I doubt that they would want to make something like this an explicit feature, so it is most likely a bug with Excel.

Related

SSIS Package Execution Fails when large size Excel File is loaded via SSIS Catalog (SSISDB)

the package execute successfully from VS but when deploy on SSIS catalog it gives following error
Error: The Execute method on the task returned error code 0x80070008 (Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)). The Execute method must succeed, and indicate the result using an "out" parameter
Excel File size is 147 mb
Yes, This problem occurs when you try to load excel file through SQL server till 2012. The limit is 120MB split your file to less than this size and try to load again.
Second solution is try SQL server 2016 and you will not face this issue.
Microsoft has acknowledged this shortcoming and has released the following package to rectify it using "newer" Access/Excel Connection managers. However, after installing and following the instructions - the same issue occurs.
The cause of the problem: The problem is caused due to a limitation that exists with office versions 1997-2003. The connection manager was designed for Office 1997 and has not been amended or improved since. This is why, when you actually research limitations on Office 2000 or 2003, you'll see that they do not allow more than 255 columns (the limit mentioned above) AND the length of the column-name cannot surpass 64 characters. These are software limitations that existed with Office 2000 and 1997 and since the Connection Manager was designed then, they just remained with it given MS did not invest in improving or updating their product. Hope this helps!
In my other consideration it may due to OLEDB provider version older version issue
Follow below link it may help you a lot
[https://blogs.msdn.microsoft.com/dataaccesstechnologies/2017/10/18/unexpected-error-from-external-database-driver-1-microsoft-jet-database-engine-after-applying-october-security-updates/][1]
Last Solution:
As you said your package is working fine but not in deployment mode right ?
So why didn't you try DTEXEC command line execution for this package. Schedule it using Windows Task Scheduler
Follow below link.
https://www.mssqltips.com/sqlservertutorial/218/command-line-tool-to-execute-ssis-packages/

Excel file on network share - It is already opened exclusively by another user, or you need permission to view and write its data

I am developing an SSIS package that uses a data flow task that has an Excel source. The provider for the connection is Microsoft.ACE.OLEDB.12.0.
If I point the connection manager to a local file on my computer and run the package in Visual Studio, it completes successfully.
However, if I point the connection manager to a UNC network share on my local domain, and run the package from Visual Studio, it fails with the following messages:
Error: 0xC0202009 at MyPackage, Connection manager "Excel Connection Manager": SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data.".
Error: 0xC020801C at Data Flow Task, Excel Source [2]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
More info:
The file from the UNC share is identical to my local file.
The file from the UNC share is not open before running the package.
My domain user (which I use to run Visual Studio) has Owner permission level for the UNC share. Also, Everyone has Read permission level for the UNC share.
Run64BitRuntime is set to False (probably not relevant).
I am runing Visual Studio locally.
Solved it by using a variable for the file path and then using that variable as an expression for the ConnectionString property of the connection.
I also doubled the backslashes in the variable that contains the pash, so instead of \computer\share\ I used \\computer\share\.
My guess is that the slashes solved the problem, but I've yet to test and find out for sure.

How can I update an Excel workbook from a scheduled SSIS package?

I have an SSIS package that imports data, then needs to update an Excel workbook for emailing. The Excel workbook contains a number of data connections set to auto refresh on open.
I have tried a number of ways to open the Excel workbook to force a refresh before emailing, and they all work when I run the package from Visual Studio, but don't work when invoked by the SQL Server agent.
Using this code from Jessica Moss, I get this error
DTExec: The package execution returned DTSER_FAILURE (1)
Using the SSIS Excel Refresh Task package from codeplex I get this error
The Execute method on the task returned error code 0x800A03EC
(Microsoft Excel cannot access the file '[my filename]')
Using a powershell update script I get this error.
DTExec: The package execution returned DTSER_FAILURE (1)
The agent is executing via proxy account with all the necessary permissions.
Excel is installed on the server.
How can I get the workbook to update when running from the SQL server agent?
Go to the system profile directory
%windir%\System32\config\systemprofile
Create a folder called desktop
Now the Excel workbook will update using any of the above methods.

powershell IQY dump script fails

I'm currently working on automating a powershell script to make a dump of a small DB.
The database is accessible through a company Sharepoint and I am leveraging an IQY file exported from said Sharepoint to read the database contents.
When I run the script manually (i.e. calling it from the command line), it works with no issues, but when I try and start the script from Task Scheduler, the following exception is raised:
System.Reflection.TargetInvocationException
the line that is generating the exception is:
$iqy = $xl.Workbooks.Open($query, 2, $true)
Where $xl is a new Excel.Application ComObject, created correctly and $query is a string containing the full file path of the iqy file.
As for my configuration, I'm trying to run my script on a Windows Server 2008R2, using a local administrator user (same user that is supposed to launch the scheduled script), which is also authorized to access the Sharepoint. I'm running Powershell 3.0. I'm not loading any Sharepoint-related snapins.
The only answers I found poking around hinted at granting "Trust" to the IQY file location and the Sharepoint itself in Excel. That did not help.
The Exception also seems to point at a sharepoint issue, but since the script runs fine when started manually, I cannot understand how it could be anything to do with Sharepoint.
Am I missing some intricacy of the Task Scheduler?
Any help would be greatly appreciated.
Never mind, I seem to have found an answer.
If anyone is encountering the same issue, it appear the Excel Com Object has a bug that does not allow it to run from the Task Scheduler if you set it to run regardless of whether the user is logged in.
To circumvent that create the following 2 folders on the machine where the script is supposed to run:
(32Bit, always)
C:\Windows\System32\config\systemprofile\Dektop
(64Bit)
C:\Windows\SysWOW64\config\systemprofile\Desktop
After creating the folders, it worked as expected.
Source: http://social.technet.microsoft.com/Forums/windowsserver/en-US/aede572b-4c1f-4729-bc9d-899fed5fad02/run-powershell-script-as-scheduled-task-that-uses-excel-com-object?forum=winserverpowershell

error while exporting data in an ssis package to an excel destination

I just moved my ssis package from my desktop to my server.The package exports data from sqlserver to an excel sheet. I see the following error when I try to run the package. The error occurs in the excel destination of the dataflow task.
Error at Package [Connection manager "Excel Connection Manager"]: SSIS Error Code DTS_E_OLEDB_NOPROVIDER_ERROR. The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. Error code: 0x00000000.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".
Error at Data Flow Task [Excel Destination [16]]: SSIS Error Code
[Excel Destination [16]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC020 9302. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
I also made the following changes as I had errors before and the package wouldnt even run .
Set the delay validation to false on the data flow task.
set the Run64bitruntime under the project properties to true
Can anyone tell me what I need to do ?
PS : I am running the package on the server and MS excel is not installed on it . Could that be causing the error ?
PS : I am running the package on the server and MS excel is not
installed on it . Could that be causing the error ?
Yes
I did also find another thread describing a solution:
HOW TO: FIX ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine
Which does not involve installing the full version of Office:
NOTE: this DOES work for office 2010 even though it is for 2007
office, dont ask me why it just does :)
download and install this: http://www.microsoft.com/download/en/confirmation.aspx?id=23734
in VS click add data source, follow the wizard and enjoy! :)
They are using Visual Studio but I imagine you should be able to run your SSIS package without having to "add a data source" as it's looking for the COM componetmicrosoft.ace.oledb.12.0 which should now be registered.
I ran into this once and had to save the excel sheets as .csv and use a flat file connection manager:
http://msdn.microsoft.com/en-us/library/ms140266.aspx
an alternative is using 32bit option in SSIS project.
Right Click on Solution and select Properties > Select Debugging and specify FALSE for option Run64Bitruntime

Resources