Unable to Open Copied SharePoint Online File via SSIS - sharepoint

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)

Related

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.

Writing a flat file in SSIS succeeds if run from VisualStudio, fails if run from the Integration Services Catalog

I have an SSIS package that does a Bulk Insert, then executes a SQL Task, and then finally writes some database data to a flat file on our network. The package runs fine if I run it from Visual Studio 2012. However, if I deploy the package to the Integration Services Catalog on a 2012 SQL Server and run it from there, the Bulk Insert and SQL Task run fine, but when the package tries to output to the flat file, I get these error messages:
Cannot open the datafile "\\nyfil006\Projects\Accounting\CostRecovery\Cafe de Novo\HospitalityCharges.csv".
HospitalityCharges Flat File failed the pre-execute phase and returned error code 0xC020200E.
I'm able to output the System::UserName to an errorlog, and it's what I think it should be: an account that has full permissions to the folder in the flat file destination (and its parent folders). I've tried creating a blank version of HospitalityCharges.csv, and DelayValidation is set to True for the Data Flow Task that outputs the flat file. My system admin has granted Network Service permissions to the folder as per this link and this link, but that doesn't help. I've also made the connection string an expression as described here. We've also created a mapped drive and used that for the Destination Connection String instead of a UNC path. No joy. Does anyone know why this is happening?
Another note: if I change the flat file destination to point to the C: drive, the package runs fine, whether I run it from Visual Studio or from the Integration Services Catalog.

Unable to import from Excel XLSX file

I have a MySQL database on a remote server. I have saved the contents of the database table as a CSV file. I have then imported that file as a worksheet into MS Excel and all is good. However, when I try to import the data from the MS Excel file as a table into an MS Access database (.accdb) using the "Import" function I get the following error:
The wizard is unable to access information in the file world.xlsx.
Please check that the file exists and is in the correct format.
The file definitely exists and is in .xlsx format.
If I try to import the data from the .csv file into MS Access I get a different error message:
Could not find installable ISAM
It would seem that I am doing something wrong but searching in Google and this site I cannot see what my error is. Both files are in a folder that is listed as a "trusted location" to prevent errors due to lack of permissions.
I would be grateful if anyone can point me in the right direction as this has me well and truly stumped.
Many thanks
Tog Porter
I tried this on a different PC and it worked OK, so it must have been something corrupt with my MS Office installation.
I completely uninstalled MS Office from my main PC and re-installed it, which fixed the problem.
Note: Using the repair function in Control Panel did NOT fix it, it had to be completely uninstalled.
Many thanks for your help and suggestions.
Tog

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.

Importing Multiple Tables from Excel Using SSIS 2008 - Exclusivity

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.

Resources