Importing Multiple Tables from Excel Using SSIS 2008 - Exclusivity - excel

I'm writing a SSRS report that is the direct result of a SSIS package.
It is my understanding that SSIS must have exclusive access to Excel files for import. Is there any way around this?
If I can't read what was there as of the last save, can I at least send an e-mail notifying the user of the failure? How do I catch that error?

This seems like a limitation of the Jet connection engine and Excel, by default, opens files in exclusive access mode. If there is only one or two people using the file, then you may be able to have them open the file in shared access mode to avoid this error. Or, since this is ultimately a Jet database engine connection, you might be able to specify in your connection string that you open it in Mode=Read.

Related

Unable to Open Copied SharePoint Online File via SSIS

OK, so we have written a utility (using Graph API) to allow us to authenticate and access files on our internal SharePoint online sites, to replace previous on-premise WebDav access, and we are having issues with the online files after they have been copied.
In simple terms, using Graph API, the process takes a file path from SharePoint Online, authenticates with the site and if the user has access to the file, copies it to a defined location. This works exactly as it should and the relevant files are correctly copied to the new location. For on-premise files, the location remains unchanged. The online files are copied as we can't find a way to integrate Graph API into SSIS, so the files need to have any permissions removed by copying them somewhere else.
We have an existing SSIS process which previously read from a list of on-premise file locations and imports the data from each Excel file into a SQL database. This worked without issue until we updated the list to include the SharePoint Online copied files. The SSIS process runs under the context of a service account, which also has read/write access to has defined location, but when the SSIS task runs, it returns with the following error:
Error: 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: "Cannot update. Database or object is read-only.".
I've obviously searched for this error, and the only suggestions are to set IMEX=1 on the connection, which is already done, and to set DelayValidation = True, again this is already done.
The SSIS process should work the same for both the existing on-premise files as it does for the online ones, but for reasons unknown, the on-premise ones work as expected, but the online ones fail. The file isn't already open elsewhere, it's copied and then the SSIS process attempts to open it, but that's where it goes wrong. I can open the copied file without issue in Excel.
Is there something about SharePoint Online that leaves a lock on a file? Is there something we need to do using Graph API to release the copy from any links to SharePoint? Myself and my colleagues have all looked at this and can't figure out why the copied files don't open.
EDIT: Looking at the context of the SSIS error, it seems the ConnectionString is valid, as is the ExcelFilePath (which matches the Data Source in the former):
ConnectionString: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\OUR_SERVER_NAME\ShareName_UAT$\Excel_Macro_Enabled_File.xlsm;Extended Properties="Excel 12.0 MACRO;HDR=NO";
ExcelFilePath: \\OUR_SERVER_NAME\ShareName_UAT$\Excel_Macro_Enabled_File.xlsm
Any ideas or advice gratefully received.
Thanks
Martin
Maybe it's related to Excel protection measures when the source file is originated from the internet?
Sometimes it helps if you open, save and close the file before reading it with ssis (https://stackoverflow.com/a/59865686/5605866)

How to make ssis excel data source task to not fail even when the file is open and being used by another user?

I have an SSIS package that will read excel files from a shared network drive. I am using excel data source task.
In visual studio the task works fine even if the excel file is open and being used by another user.
When I deploy the package to the ssis catalog, and execute, the package fails when the file is open with someone.
Is there any way to make the excel task work even when the file is open?
By default the Excel provider controls this since it doesn't open a file in shared mode.
You can otherwise use a File System Task to copy the Excel file from a shared location to a private one and use it in your Data Flow.

How to get the internal table data in excel format if the report runs in background?

Could you please tell me the way to get internal table data in excel file to be saved in local desktop (presentation server). Remember that the report runs in background.
Both requirements a contradictionary because a backround job does not have any connection to any SAPGui. I.e. there is no SAPGui connection linked to a background job ans thus it is not possible to determine onto which local desktop the excel file should be saved.
A possibility would be to store the results that are created in the backround job somehow and externalize the save to a local desktop into another program. When creating files on the SAP AS you should keep in mind what happens with these file after they are not needed any longer. I.e. you need to do the file maintenance (deletion of files after they are not needed any longer) your self.
Theoretically you can do this, if you create the file on a SAP AS and move this file using any shell file move command. However, it's a bad practice to make any connection from SAP AS to a user's machine.
The best solution here is to create the file on SAP AS. The user must download the file manually from the SAP AS. You can also send this file to a user for example per e-mail. The user will do no manual work in the last case.
Also a good practice is to use PI server functionality. It can deliver your file within a way the user wants to have.

MS-Access 2013 unable to remove .laccdb locking file

This is a long shot, but does any one know how to remove the lock file created by access 2013 file type ".laccdb".
I have an excel sheet which is connected to the access database via power query. The access database is on a shared drive. However even when this file is closed the locking file for the access database is not deleted.
When trying to remove the lock file it just says that unable to close as another program is using.
I've closed down the machine, removed all temp files, checked nothing is running and also checked in computer management within the administration tools. and checked for any open files.
I know the database should be split to stop this happening. however this is not my database, and the user refuses to split.
Any help will be grateful.
You can open and read the lock file with a text editor (I use Notepad++); within the file you should find the computer name (or some similar identifier) of the one(s) who have it open. You could then take that name/number/whatever to IT and see if they can identify who the user is. You should be able to close it from their computer. Hope this helps.

How do I access SQLite from VBA?

I have an Excel workbook that has some adodb code that queries a local access database. I want to do the same for SQLite as I believe that will provide better performance. How do I do that? Can I connect to an SQLite file using adodb or odbc?
I need something simple that I can deploy so that if i can minimize unnecessary configuration and installation maybe peoople that will be using the excel won't have admin rights on the pc so they can't install software.
Facing the same question, I made a lightweight library to give direct access to SQLite3 from Excel VBA. The end result is a much simpler solution, with no intervening ODBC or OleDb/ADO layer, and the performance reflects the SQLite database performance and not that of the opaque wrapper. It's also nice because you need no registration of a COM component in the registry, you just copy two .dlls with your workbook and add a .bas module into your project.
A disadvantage of this approach is that the API is not the standard DAO or ADO interface, so you might need to make some wrappers, or convert some of your code to make it work. That also means you need some familiarity with the SQLite API to use it, but the SQLite documentation is very clear.
I have put an early version of the project on CodePlex: SQLite for Excel provides a high-performance path to the SQLite3 API functions, preserving the semantics of the SQLite3 library calls and allowing access to the distributed SQLite3.dll without recompilation.
Any feedback would be much appreciated.
Update: The SQLite for Excel project now lives on GitHub.
How to access sqlite from vba macro from here (original article in chinese) :
Software environment:
1) Win7 (32 bit) 2) Excel2007 (with VBA function)
Steps:
1) First,
http://www.zsplat.pwp.blueyonder.co.uk/programming/sqlite-3.5.7-odbc-0.65.zip
download and install the SQLite ODBC driver.
Note: If you use Win7, then you need to Adminitrator permissions,
otherwise the installation fails. The simplest step is to use the
Administrator login, and then install the SQLite ODBC driver.
2) Open the Excel VBA code editor window, the menu bar [tool] ->
[reference], adding Microsoft ActiveX Data Objects 2.7, the purpose is
to use VBA, and database connectivity.
3) Use the following code to connect SQLite database:
Dim conn As New ADODB.Connection
Dim dbName As String
'Define the connection string
dbName = "Driver = {SQLite3 ODBC Driver}; Database = D: \ yourdbname.db"
'Open the database
ff.Open dbName
ff.Execute "create table a (a, b, c);"
'Other operations on and VBA to connect to other DB like Access the same.
'Close connection
ff.Close
There're some DLLs that you can use to access a SQLITE Database from Visual Basic using adodb. I think here is the info that you're looking for. I never tried it, but the link can be usefull for you.
Good Luck.
I've used Datenhaus' dhSQLite and it works well.
google sqliteforexcel and download it from github
govert responded to this already (the creator), the easy solution to me, unless you can't.. don't use Access. Transfer the data to sqlite db files. You can even use ADO to a server or DAO and read the rs directly in to a sqlite table
It requires no driver or install. You can have your workbook download the 2 .dll's from a shared location on file open(check if they don't already exist on their file system, on say c:\temp), then user is running sqlite. I suspect, if you're so inclined to ask this, you'd want to write a function to loop calls to the appropriate sqlite functions(explained in example docs) and read returned data in to a vba array. Then you can do whatever you want with it.

Resources