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

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.

Related

SSIS Package Export on-premise SharePoint List to SQL Server

I have created an SSIS package on my local development machine that is running VS2019 Prof and SQL Server 2019.
Every thing is working as expected, but I have one SharePoint List with 10,000 items which keeps failing with the message:
Error: 0xC02090F5 at Load Data From SharePoint Absence List, Absence [2]: The Absence was unable to process the data. An error occured when reading the OData feed.
Error: 0xC0047038 at Load Data From SharePoint Absence List,
SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Absence returned error code 0xC02090F5.
The component returned a failure code when the pipeline engine called PrimeOutput().
The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
There may be error messages posted before this with more information about the failure.
It always fails at the same record with is just under 4,000 transferred. This is the only error that I have found.
I have exported the data from SharePoint into Excel, which returns the full dataset and cannot see any issues with the data.
The SSIS package is using an OLE Db connection to access the data, other SharePoint lists are read and completed by the same SSIS package using the same connection.
My thoughts:
Is this an OLE Db issue?
Do I need to set some parameter to the OLE Db connection?
Does this need to be sperated into it's own SSIS package?
Can I find out more information about the specific error?
Does anyone have any helpful advice on how to proceed?
I have tried:
Adding SharePoint Libraries
Started looking at Power Automate, learning curve
Power BI, but again a learning curve, so far I have created a data query which can see all of the items in the list, great, but I have no idea on how to push the dataset into SQL Server. I've created a transformation and tried Python, but that does not work.
UPDATE
I have checked the data in the record and everthing is OK. No hidden formating or odd charactors, date all in UTC format, etc...

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.

Run Excel Macro using SSIS throught SQL Jobs failed

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.

Scheduled Task Not Creating Excel File

I developed an application which grabs some data from our server, spits it out into an excel sheet, and emails that sheet to specific users. I needed this application to launch every 30 minutes so I setup a scheduled task on our server to run this application. What I can't figure out is this: The application runs (I can see that the data is being collected from our database (marked as hit in a [Processed] column)), but it will not create the excel file, and consequently does not send the email.
I need to figure out why so this process can work for me. A few things to note:
1.) I am an admin for this machine. (double checked my authorities)
2.) Excel IS installed on this machine.
3.) The scheduled task doesn't work, but if I manually run the program it executes perfectly.
4.) Proper versions of .Net are installed.
5.) Other scheduled task exist that do similar operations and have no issues.
The server is 2008 Enterprise.

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